No network response from PHP network functions through IIS 7

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
jeff00seattle
Forum Commoner
Posts: 66
Joined: Sat Feb 28, 2009 3:27 pm

No network response from PHP network functions through IIS 7

Post by jeff00seattle »

Take this simple PHP script which gets contents from a website:

Code: Select all

$response = file_get_contents(http://www.google.com);
If I call this script within a PHP file as a script through Eclipse PDT, it provides a response.

If I call this script within the same PHP file was a webpage through IIS 7, it provides no response (false).

If I run this same script on the same box in WAMP, no problems.

The same is true if I use PHP cURL:

Code: Select all

$ch = curl_init(); 
$timeout = 0; 
curl_setopt ($ch, CURLOPT_URL, 'http://www.google.com'); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); 
$response = curl_exec($ch); 
curl_close($ch);
Jeff in Seattle
Post Reply