Jump to content

file_get_contents and curl not working for some url


Reneb

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);
var_dump($status);

(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 thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.