Forum Moderators: coopster

Message Too Old, No Replies

grabbing remote/outside page data

         

ralliiart

6:41 pm on Apr 7, 2006 (gmt 0)

10+ Year Member



the question i am asking probably has a simple answer. i want to be able to grab the source code from an outside URL, so i can deal with it in my page. an example of this would be sending an XML feed request via a specific URL, and getting a page of XML in return- then dealing with the returned XML information on my own... how do i send the request, and how do I read the returned information? I want to do all of this from within my own page/script.

ralliiart

6:51 pm on Apr 7, 2006 (gmt 0)

10+ Year Member



i'm probably not suing the right terms here, but i suppose as another example, i'd need to accomplish the same thing to spider an outside website, like a search engine would do when they spider your site. i basically just need to know how to setup the request and retreival of the information - i can do the rest.

1) request the site's source code / page via URL from within my script
2) retrieve the requested information from within my script
3) deal with / parse the information inside my script

coopster

9:21 pm on Apr 7, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, ralliiart.

PHP has Filesystem functions [php.net] such as file_get_contents [php.net] that make this easier. If you need to POST information first you can open your own socket or use curl. To parse the XML code returned you can use a number of functions but one of the easiest is the new SimpleXML functions [php.net] bundled with PHP5.