pulling content from a URL
| From: | Nicholas W . Miller | Date: | Fri, 04 Mar 2005 22:21:52 +0000 |
| Subject: | pulling content from a URL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-210050@lists.php.net to get a copy of this message | ||
I'm writing a script that needs to put the contents of an external URL into a variable. I need to include some sort of error checking that will kill this request if for some reason the URL request hangs for more then 15 seconds. In researching this, I think the correct function to use is fsockopen, but I can't seem to get it to work. Can someone verify if fsockopen is the best way to grab an external URL, but kill the request if it hangs for a certain amount of time ... and if so, show me some sample code on how to place this URL's contents into a variable that I can then parse. The URL will be hard coded into the script, so I don't need a lot of error checking to insure correct URL format, etc.
Thanks,
Nicholas Miller
Intercast Media, Inc.
229 19th Ave. Suite 4
San Francisco, CA 94121
415-379-9500
415-520-9501 (fax)
nick@intercastmedia.com