Link to home
Start Free TrialLog in
Avatar of Zeek0
Zeek0

asked on

PHP read web page contents

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.
SOLUTION
Avatar of star_trek
star_trek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of waygood
waygood

whats the url your trying to get. If we can retrieve it ok, then we can offer a solution that should work for you. (win200, apache 2, mysql 4)

p.s. I luv curl.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zeek0

ASKER

I figured out that the problem was, in fact, with IIS 6.  The application pooling doesn't allow sockets to be created, let alone opened and used to transfer data.  Lord only knows why, but I got the script I had to work when I set the application pooling to "IIS Isolation Mode" and chose "Low (IIS Process)" for the 'application protection' setting.  

I don't know why I had to change those settings, but they made my script work.