Well, this is loooooong overdue, just been busy on my side :) But, here are some useful snippets of code :)
Screen scraping in essence is grabbing data from a already generated page, either from one of your own sites or another person/entity/organizations' pages. Why would one need this? Well, sometimes not all web builders have API's that you can connect to to retrieve useful information, such is the case with stock exchanges etc. For this reason, I made the following simple script in Python to retrieve the stocks that I watch for me :)
So, what does the code look like? Well, firstly, the page that I will be retrieving is http://finance.google.com/finance?q=IBM
Here is the Python code:
click to enlarge or download
As can be seen from the code, it is pretty basic :) To test it, make certain that you have python installed (this is installed by default on Ubuntu and Mac OSx, Windows users, hit Google ;)). Go to terminal, and simply type
python screen.scraper.py
And you will start seeing the quote's being printed out :)
Next up, PHP & cUrl:
click to enlarge or download
Pretty basic still, not true? To execute, simple run the command:
php php.screen.scraper.php
In terminal (Mac OSx and Linux, Windows you know where to go)
So, onto the other equivalent : HTTPRequest & PHP
click to enlarge or download
See, pretty simple still? Who said coding should be hard :)
Well, that is all for this week, happy playing, and see what you can come up with using these different methods ;)






