Неизвестная ошибка протокола SSL при подключении к site.com:443 - PullRequest
0 голосов
/ 11 мая 2019

Я получаю

Неизвестная ошибка протокола SSL при подключении к sofifa.com:443

ошибка при выполнении curl в PHP (версия 5.4.21). Как я могу решить эту проблему?

Спасибо всем, кто помог.

CENTOS: CentOS выпуск 5.10 (финальный)

SSH:

# curl -v https://sofifa.com/squad/255177
* About to connect() to sofifa.com port 443
*   Trying 23.92.23.30... connected
* Connected to sofifa.com (23.92.23.30) port 443
* successfully set certificate verify locations:
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
Unknown SSL protocol error in connection to sofifa.com:443
* Closing connection #0
curl: (35) Unknown SSL protocol error in connection to sofifa.com:443

Php Curl Code:

private function curl($url){

$headers[]  = "User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13";
$headers[]  = "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8";
$headers[]  = "Accept-Language:en-us,en;q=0.5";
$headers[]  = "Accept-Encoding:gzip,deflate";
$headers[]  = "Accept-Charset:utf-8,ISO-8859-1;q=0.7,*;q=0.7";
$headers[]  = "Keep-Alive:115";
$headers[]  = "Connection:keep-alive";
$headers[]  = "Cache-Control:max-age=0";

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_REFERER, "https://sofifa.com");
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSLVERSION, 3);

$data = curl_exec($curl);

if (curl_error($curl)) {
$error_msg = curl_error($curl);
$return = array('status'=>'error','content'=>$error_msg);
} else {
$return = array('status'=>'ok','content'=>$data);
}

curl_close($curl);
return $return;

}
...