Using
$curl_handle = curl_init();
curl_setopt( $curl_handle, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $curl_handle, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $curl_handle, CURLOPT_HEADER, 1 );
curl_setopt( $curl_handle, CURLOPT_VERBOSE, 1 );
curl_setopt( $curl_handle, CURLOPT_URL, "https://www.someurl.com" );
$buffer = curl_exec( $curl_handle );
print_r( curl_getinfo ( $curl_handle ) );
I get
Array ( [url] => https://www.someurl.com [content_type] => [http_code] => 0
[header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0
[redirect_count] => 0 [total_time] => 10.00005 [namelookup_time] => 0.001271
[connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0
[speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1
[upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 )
So it seems not to be connecting to the server, yet the identical code works fine from my local machine. Is there any way to get more information? My suspicion is that either my webhost is blocking the outgoing connection or the server I'm trying to connect to is refusing the connection (at one stage a few months back they were doing this but I was at least receiving 403 messages, now I'm getting nothing). I've tried increasing the timeout but same result (with 10 replaced by the timeout in the response). Also, the namelookup_time seems very small, so I wonder if that is failing somehow?
Thanks.
UPDATE: I can retrieve google.com fine from both my web server and my local machine so it seems it's not my webhost blocking me. I have tried numerous proxies and the page is retrieved from my local machine but not on my webserver (identical results to what I posted above). I can't work out how to connect via IP, but the namelookup_time is much much smaller than it is for the google.com page. Given this small amount of extra info, does anyone have any other ideas?