Click to See Complete Forum and Search --> : Problem with url open


JTo
05-22-2007, 03:17 PM
Code
<?php

if (file_get_contents("http://example.com/")){
echo "Working!";
}else{
echo "Why, why, why?";
}

?>

For some reason I get error_message Warning: file_get_contents(http://example.com/) [function.file-get-contents]: failed to open stream: Host is down in.

Tried it without my own firewall.
In php.ini:
allow_url_fopen = On
safe_mode = Off

What is could be cousing this problem?


(And yes, I have tried it with n-number of url -> not working at my home computer, but works perfectly at server; so the problem is definetly at my computer, but...?)

Sheldon
05-22-2007, 06:35 PM
try looking at fsocketopen (http://php.net/fsocketopen)

JTo
05-22-2007, 06:40 PM
I actually tried it already with the example http://at2.php.net/manual/en/function.fsockopen.php-code at PHP.net page - same problem occurs...

JTo
05-24-2007, 08:53 AM
Doesn't anyone have any kind of solutions or workarounds for this?

I'm using Mac OS X with MAMP.

My purpose is to be able to load xml-file from one of my servers and do something with it...