I can use both file_get_contents and CURL to fetch the contents of a file on my server, but when I attempt to read a file from outside the server, both just spin forever, never reading the file.
I'm on IIS7 - and Curl is installed and running. I can browse to the locations with no trouble, but if I attempt to fetch the files using PHP, I get nothing.
Is there some other setting in IIS that I need to enable or disable?
What am I missing?
Neither works:
$sourceLink = "http://www.google.com";
$sourcePageHTML = file_get_contents($sourceLink);
print $sourcePageHTML;
$ch = curl_init("http://www.google.com");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
print($data);
Both work:
$sourceLink = "http://myserver/myfile.php";
$sourcePageHTML = file_get_contents($sourceLink);
print $sourcePageHTML;
$ch = curl_init("http://myserver/myfile.php");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
print($data);