Reneb Posted January 15, 2015 Share Posted January 15, 2015 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)) Quote Link to comment https://forums.phpfreaks.com/topic/293970-file_get_contents-and-curl-not-working-for-some-url/ Share on other sites More sharing options...
requinix Posted January 15, 2015 Share Posted January 15, 2015 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? Quote Link to comment https://forums.phpfreaks.com/topic/293970-file_get_contents-and-curl-not-working-for-some-url/#findComment-1503093 Share on other sites More sharing options...
Reneb Posted January 15, 2015 Author Share Posted January 15, 2015 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) Quote Link to comment https://forums.phpfreaks.com/topic/293970-file_get_contents-and-curl-not-working-for-some-url/#findComment-1503094 Share on other sites More sharing options...
requinix Posted January 16, 2015 Share Posted January 16, 2015 It may very well be firewalled on the host's side. If they have shell access they can try to troubleshoot some more, but without that it's basically just guessing. Try other hosts and other ports and see what works. Quote Link to comment https://forums.phpfreaks.com/topic/293970-file_get_contents-and-curl-not-working-for-some-url/#findComment-1503099 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.