Problem getting response from server using cURL, file_get_contents, etc
I am trying to get the response from a server, which is now not giving any response. I tried file_get_contents()
, cURL
, and tried getting the headers, but apparen开发者_如何学Pythontly the server is not responding. There are no headers returned or any response of any kind. Also, this happens when I try from my web server - it works fine in my local machine.
curl_error($ch)
returned: couldn't connect to host
Why does this happen? I mean what are the possible situations when curl_errno
is 7?It's because it fail to connect to the host or proxy. Can you ping this server? If so, can you give us the link? We could try it and tell you what's wrong.
If you're on a shared host, there's a great likelihood that they disallow cURL and remote file_get_contents
. If you can't connect at all and you can connect on your own machine, then this may very well be the issue.
精彩评论