2013-12-15 217 views
0

我正在嘗試使用WHMCS API將第三方腳本連接到它。我創建了第三方的腳本,但是,當我嘗試使用HTTPS連接到我的網站時,出現此錯誤:錯誤:140770FC:SSL例程:SSL23_GET_SERVER_HELLO:未知協議PHP使用SSL時的捲曲錯誤

如果我使用HTTP,一個404錯誤。代碼如下(是的,這是我的實際域,因爲我想通了SSL的細節可能無關緊要):

$email = $_GET["email"]; 
$password = $_GET["password"]; 
if(filter_var($email, FILTER_VALIDATE_EMAIL) && strlen($password) > 0) { 
    $postfields["username"] = $apiusername; 
    $postfields["password"] = $apipassword; 
    $postfields["action"] = "validatelogin"; 
    $postfields["email"] = $email; 
    $postfields["password2"] = $password; 

    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, "https://tfdidesign.com/accounts/includes/api.php"); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_TIMEOUT, 100); 
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
    $data = curl_exec($ch); 
    if(curl_error($ch)) 
     echo(curl_error($ch)); 
    curl_close($ch);  
    $data = explode(";",$data); 
    foreach ($data AS $temp) { 
     $temp = explode("=",$temp); 
     $results[$temp[0]] = $temp[1]; 
    } 
} 
else 
    die("INVALID_CREDENTIALS"); 
+0

我有同樣的問題,你有沒有找到任何解決辦法? – zhilevan

回答

-1

定義SSL版本爲您捲曲(也可以是2或3):

curl_setopt($curl, CURLOPT_SSLVERSION,3); 

也可以嘗試使用這一個:

curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); 
+0

現在頁面無限超時。 –