Showing posts with label internet. Show all posts
Showing posts with label internet. Show all posts

20100826

Dynamic, Database Driven Websites with PHP + MySQL

Face it. Most websites are a bit boring in functionality. Not necessarily a bad thing in most cases, but sometimes you need a bit more power to make a website function beyond what you could do if you were to develop each and every page manually. One by one.

What if I told you I could almost instantly make 200,000+ unique pages on a website as soon as I wrote the software to do it, and uploaded it to my web server? That is exactly what I did with my two sites here, SingleBlackDating, and FileFin.

Unfortunately, the sites no longer exist on the web anymore since I've stopped my internet company and started on my career path to be an engineer and physicist. Luckily, I still have the software and databases behind the two websites, and some old screenshots of one them thanks to the Web Archive.

SingleBlackDating.com
This was notably a dating site geared toward the African-American demographic.  There are a lot of African-Americans all over the 50 States of the US, so how do I make custom web pages based on state, county, city, and ZIP code? Why, with an enormous database provided by the Census Bureau, of course!  Using PHP and MySQL database software, I was able to construct a dynamic website that made pages on the fly based on information I fed the site from a assortment of databases of information.  The website used the State/County/City/ZIP database to break the website down into over 200,000+ pages, all based on a unique US city or ZIP code listed. Each city page had a short blurb advertising the dating service, and pulled even more information from a database of restaurants, and even recommended a restaurant for a date.  The site isn't viewable anymore, but you can download the software and databases that ran it.
Download SingleBlackDating.com

FileFin.com
A site for free software developers to promote their stuff. Not your typical site. Using a bit of imagination you can actually make your websites do work for you.  In order to promote SingleBlackDating.com I constructed FileFin.com, a dynamic databases driven site with PHP, MySQL, and a freeware package called PadKit. How it worked was when a software developer found my site, he/she was looking to list their software in my database of free software for all of the web to see.  The site was free to use, but there was a catch. The software developer had to make a link on their website promoting my SingleBlackDating.com site. On the free software submission page I had PHP and MySQL automatically select a unique web page from the 200,000+ for the developer to link to on his/her site.  The problem was, how was I sure that the software developer actually did link back?  Well, thanks to PHP programming I wrote a little piece of code that checked to make sure a link to my site was found before the submission went through. If there was no link back, the software developer could not link to my site.  All of this was automatic, and I never had to maintain the site. Last I checked on FileFin, there were 11784 software submissions.
Download FileFin.com
Here are some screenshots of the site I found on the Web Archive:

Augmented Browsing with Ruby Programming Language + Watir Module

Some things on the world wide web cannot be automated easily. The PHP/cURL combination is typically the most convenient and controllable way of automating the web and mimicking a normal web user, but there are roadblocks and obstacles along the way that can prevent you from using that particular type of programming easily.

When I say obstacles, I mean when web developers use sophisticated Javascript or AJAX in their web pages. The cURL library doesn't like this very much, and it is a bit more difficult to read the HTTP protocols necessary to send back to the web server the website is hosted on. In comes augmented Browsing with Ruby/Watir!

What is Ruby?
Ruby is an object-oriented programming language with a bit more power than PHP (a scripting programming language), although arguably a different aim in intentions for web purposes. Ruby nevertheless is growing in popularity amongst web developers, but is still the minority compared to PHP.

What is Watir?
Watir is an automated web browsing testing toolkit. It uses a technique called augmented browsing that allows it to literally and visually drive the Internet Explorer browser on your desktop computer programmatically. Instead of simulating a browser, like cURL, Watir steers the actual browser on your computer with Ruby's built-in OLE and COM support.


Ruby + Watir = Using your internet browser with no hands
Because you are actually controlling a real browser like Internet Explorer, obstacles in websites like funky Javascript and flashy AJAX are much easier to tackle. The problem is augmented browsing with Ruby/Watir is slow as molasses in comparison to PHP/cURL.

FBPoster
This program automated Facebook and didn't have any practical application other than to see how Watir worked, and if I could do it. It could log into your Facebook account, use the search box to look for Facebook groups related to a keyword, then it would post a custom comment of your choice in that group. Only you didn't do it, the software did!
Download FBPoster

GGrouper
Basically allowed you to log into your Google account, and if you have a Google Group set up, you can automatically make new pages in the group based on a set of keywords you give it in a text file.
Download GGrouper

VeohBlack
A bit more complicated than the first two software, VeohBlack made it easy to register accounts at the Veoh video site. It could then use the accounts to search for particular types of videos and make comments on them. It could even click to the next page of videos if you wanted.
Download VeohBlack