AJAX / PHP Text Grabber

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
QuickSnail
Forum Commoner
Posts: 46
Joined: Fri Dec 21, 2007 11:13 am

AJAX / PHP Text Grabber

Post 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
ocpaul20
Forum Newbie
Posts: 12
Joined: Thu Jul 05, 2007 3:53 am

Re: AJAX / PHP Text Grabber

Post 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...?)
QuickSnail
Forum Commoner
Posts: 46
Joined: Fri Dec 21, 2007 11:13 am

Re: AJAX / PHP Text Grabber

Post 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!
Post Reply