Page 1 of 1

AJAX / PHP Text Grabber

Posted: Mon Aug 31, 2009 6:15 pm
by QuickSnail
Alright so I want to use AJAX to run a back end script off the server to grab some text off of another website, then echo that text to the original page.

For example:

Index.php: Starts the AJAX command asking for script.php.
script.php: Opens up (on the server) the webpage (e.g. index2.php) sees the text sends the text back to index.php
Index.php: Then getting the response echos that text.

Possible?
Am I looking at it the wrong way? Should I use a different coding?


EDIT: Take note that index2.php would be on a server that is not controlled by I. i.e. Google.com

Re: AJAX / PHP Text Grabber

Posted: Mon Aug 31, 2009 9:10 pm
by ocpaul20
There are plenty of screen scraping programs out there, also look up how to use CURL statements to read pages from another website or file get contents too I think. Google recommends you use their API to obtain their search results (if thats what you are doing...?)

Re: AJAX / PHP Text Grabber

Posted: Mon Aug 31, 2009 11:02 pm
by QuickSnail
Ok cool thanks.
Naw I'm not using it for search results. I have a personal homepage I use for all my computers and I wanted to get stock updates off of google.


EDIT: Thank you so much! Curl worked perfectly! Had to fine tune the substr strings a bit but worked great!