My Code:
<?php
$url = "http://www.myurl.com/";
/*$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"User-Agent: ".$_SERVER['HTTP_USER_AGENT']
)
);
$context = stream_context_create($opts);*/
$content = file_get_contents($url);
echo $content;
?>
I receive the following error:
Warning: file_get_contents(http://www.myurl.com/) [function.file-get-contents]: failed to open stream: Connection timed out in /home/content/myurl/contents.php on line 10
The code won't work for me when I am either creating or not creating a stream context. Interesting thing is that it would work on any other site that I have tried, except for my own.
PS: It does not matter if I do it with or without "http" or "www".
PSPS: allow_url_fopen is ON
PSPSPS: I have set the following in .htaccess:
<filesMatch "\\.(html|htm|php)$">
Header set Cache-Control "max-age=1, private, must-revalidate"
</filesMatch>
Could this be a problem?