Jump to content

file_get_contents and curl not working for some url


Recommended Posts

Hi everyone


I've look all other the web for a work around that.

basically my problem is:


if i use file_get_contents or curl to get www.google.fr, there is NO problem. i get the data i want

but when i try to use it on another target it doesn't work. it loads and loads for couple seconds and finally says that it could not retrieve informations.

the target is not blocked as i can personnally use it on my webhost, but some people on other webhosts can't.


A friend of mine told me that it was because some webhosts blocks unsecure targets.


Is there any way around it?

$context = stream_context_create(array(
    'http' => array(
        'header'  => "Authorization: Basic " . base64_encode("admin:$password")

$data = file_get_contents("http://TARGETHOST:29015/status.json", false, $context);
$status = json_decode($data);

(And again this works on my webhost, i can query like that any servers i want, but others can't use this they get a timeout trying it (when doing a file_get_contents on google works))

Link to comment
Share on other sites

Some people can't use it? It could totally be an issue with their host. Especially if they can't get other things.


It's not like TARGETHOST is some local server, right? It's something sitting out there in the internet that anybody should be able to access without any firewalls or LANs to get in the way, right?

Link to comment
Share on other sites

yes no firewalls.

even in LAN they can't use it.

it's obviously something wrong with the host. But the problem is that most of the hosts don't let those requests past.


There is actually 1 specifics about the target is that it's a webserver from C#. (it starts when the game server starts, so i don't think it has any extensions to it, no signatures, just plain html i would guess)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.