PHP curl quebrado

1

Curl parece travar ao fazer chamadas. Isso está quebrando sites wordpress / wp-admin & a biblioteca auxiliar twillio usada para o IP-SMS.

Esse problema apareceu após a instalação do vsftpd e a criação de novos usuários.

script para testar o curl: (do google)

function nxs_cURLTest($url, $msg, $testText){  
  $ch = curl_init(); 
  curl_setopt($ch, CURLOPT_URL, $url); 
  curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36"); 
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
  curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  $response = curl_exec($ch); 
  $errmsg = curl_error($ch); 
  $cInfo = curl_getinfo($ch); 
  curl_close($ch); 
  echo "Testing ... ".$url." - ".$cInfo['url']."<br />";
  if (stripos($response, $testText)!==false) 
    echo "....".$msg." - OK<br />"; 
  else 
  { 
    echo "....<b style='color:red;'>".$msg." - Problem</b><br /><pre>"; 
    print_r($errmsg); 
    print_r($cInfo); 
    print_r(htmlentities($response)); 
    echo "</pre>There is a problem with cURL. You need to contact your server admin or hosting provider.";
  }
}

  nxs_cURLTest("http://www.nextscripts.com/", "HTTPS to NXS", "Social Networks");
  nxs_cURLTest("http://www.google.com/intl/en/contact/", "HTTP to Google", "Mountain View, CA");
  nxs_cURLTest("https://www.google.com/intl/en/contact/", "HTTPS to Google", "Mountain View, CA");
  nxs_cURLTest("https://www.facebook.com/", "HTTPS to Facebook", 'id="facebook"');
  nxs_cURLTest("https://graph.facebook.com/", "HTTPS to API (Graph) Facebook", 'get');  
  nxs_cURLTest("https://www.linkedin.com/nhome/", "HTTPS to LinkedIn", 'rel="canonical" href="https://www.linkedin.com/');

saída:

Testing ... http://www.nextscripts.com/ - http://www.nextscripts.com/
....HTTPS to NXS - OK
Testing ... http://www.google.com/intl/en/contact/ - http://www.google.com/intl/en/contact/
....HTTP to Google - OK
Testing ... https://www.google.com/intl/en/contact/ - https://www.google.com/intl/en/contact/
....HTTPS to Google - Problem
Failed to connect to www.google.com port 443: Connection timed outArray
(
    [url] => https://www.google.com/intl/en/contact/
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.003154
    [namelookup_time] => 0.004183
    [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
    [redirect_url] => 
    [primary_ip] => 
    [certinfo] => Array
        (
        )

    [primary_port] => 0
    [local_ip] => 
    [local_port] => 0
)
There is a problem with cURL. You need to contact your server admin or hosting provider.Testing ... https://www.facebook.com/ - https://www.facebook.com/
....HTTPS to Facebook - Problem
Failed to connect to www.facebook.com port 443: Connection timed outArray
(
    [url] => https://www.facebook.com/
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.003227
    [namelookup_time] => 0.004192
    [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
    [redirect_url] => 
    [primary_ip] => 
    [certinfo] => Array
        (
        )

    [primary_port] => 0
    [local_ip] => 
    [local_port] => 0
)
There is a problem with cURL. You need to contact your server admin or hosting provider.Testing ... https://graph.facebook.com/ - https://graph.facebook.com/
....HTTPS to API (Graph) Facebook - Problem
Failed to connect to graph.facebook.com port 443: Connection timed outArray
(
    [url] => https://graph.facebook.com/
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.003548
    [namelookup_time] => 0.004187
    [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
    [redirect_url] => 
    [primary_ip] => 
    [certinfo] => Array
        (
        )

    [primary_port] => 0
    [local_ip] => 
    [local_port] => 0
)
There is a problem with cURL. You need to contact your server admin or hosting provider.Testing ... https://www.linkedin.com/nhome/ - https://www.linkedin.com/nhome/
....HTTPS to LinkedIn - Problem
Failed to connect to www.linkedin.com port 443: Connection timed outArray
(
    [url] => https://www.linkedin.com/nhome/
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 5.003194
    [namelookup_time] => 0.004179
    [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
    [redirect_url] => 
    [primary_ip] => 
    [certinfo] => Array
        (
        )

    [primary_port] => 0
    [local_ip] => 
    [local_port] => 0
)
There is a problem with cURL. You need to contact your server admin or hosting provider.

Curl ainda está instalado no meu servidor, verifiquei isso por meio de phpinfo();

a reinstalação do módulo de curvar não ajudou.

sudo apt-get install php5-curl
sudo service apache2 restart
    
por THE AMAZING 21.04.2016 / 15:54

1 resposta

3
Failed to connect to X port 443: Connection timed out

isso parece mais um problema de rede, em vez de php e / ou curl , deve-se tentar replicá-lo via curl e / ou wget do shell.

    
por 21.04.2016 / 16:11

Tags