php - cURL : "Couldn't connect to host" -


i have solved in past, cannot remember how.

so, i'm trying fetch webpage server, using proxy.

here code :

function curlfile($url,$proxy_ip,$proxy_port,$loginpassw) {      $ch = curl_init();     curl_setopt($ch, curlopt_url, $url);     curl_setopt($ch, curlopt_header, 0);     curl_setopt($ch, curlopt_returntransfer, 1);     curl_setopt($ch, curlopt_proxyport, $proxy_port);     curl_setopt($ch, curlopt_proxytype, 'http');     curl_setopt($ch, curlopt_proxy, $proxy_ip);     curl_setopt($ch, curlopt_header, false);     curl_setopt($ch, curlopt_verbose, false);     curl_setopt($ch, curlopt_proxyuserpwd, $loginpassw);     curl_setopt($ch, curlopt_httpproxytunnel, 0);       $data = curl_exec($ch);      if(curl_errno($ch)){              echo 'curl error: ' . curl_error($ch);     }      print_r(curl_getinfo($ch));     print_r(curl_error($ch));      print_r($data);      curl_close($ch);      return $data; } 

all outputs :

curl error: couldn't connect hostarray ( [url] => http://www.drkameleon.com [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.007872 [namelookup_time] => 0.007537 [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 ) couldn't connect host

so, ideas? going wrong?

your webserver unable connect proxy

  • local security settings on webserver - didn't os running on
  • a routing issue on webserver
  • firewall policy on proxy

the proxy requires authentication? (you should have got 4xx response proxy - if you've got cli adccess try running curl comand line).

the proxy got nxdomain on lookup or didn't ip address expecting.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -