PHP read web page contents
Posted on 2006-04-20
I've been trying to read the contents from a particular URL into a string in PHP, and can't get it to work. I've tried the Request.PHP PEAR module, the cURL methods, and the standard file_get_contents() function, but no matter what I do, I can't seem to get anything.
I'm running PHP 5 w/ IIS 6 on a Win2k3 server. The URL I'm trying to read responds with an XML fragment, based on some query data I send to it. There URL changes based on the query data, but when I output the URL from my script into a link and click it, I get the XML fragment returned to my browser with no trouble. So I know that the URL I'm trying to pass to the various methods is indeed valid and will indeed respond with an XML fragment.
Again, when I try to get the same fragment into a from within my PHP script (using the URL from a string variable) into a string, I get nothing. I've tried code that apparently works on an Apache server (using the Request.PHP module), but nothing I try gets anything. I've used all kinds of var_dumps to see what's going on, and everything looks like it checks out, but nothing ever comes through into the string.
Can anyone think of what the problem might be? I'm really struggling here and cannot for the life of me figure out what the problem is. I've got another question on here with a title like PHP / CAS question that has more information. I've been screwing with this for over a week now and I need to figure it out.