I've installed php 5.3.14 on Ubuntu Desktop 12.04.
with: allow_url_fopen = 1
Doesn't work bellow:
<?php
echo file_get_contents('http://www.example.com');
Works bellow:
<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
Even curl_exec() works. I've also tried like this with Python, Python could fetch www contents.
I'm not using Firewall, Proxy.
But no problem with local network. (192.168.1.36 is my local server machine.)
<?php
echo file_get_contents('http://192.168.1.36);
Is any configuration or installation problems? Thanks.