直到幾天前,一切進展順利,但現在,Curl已停止爲使用HTTPS的地址工作。
這是代碼:PHP CURL突然停止在https請求上工作
$url = 'https://android.googleapis.com/gcm/send';
$fields = array(
'registration_ids' => array($registation_ids),
'data' => array("message" => $message,
"title" => $title,
"params" => $params,
"code" =>$code),
);
$headers = array(
'Authorization: key=' . GOOGLE_API_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
此代碼已經超過一年的平穩運行。但現在它返回:
代理錯誤
代理服務器收到來自上游服務器的無效響應。 代理服務器無法處理請求GET /app/test_notifications。
原因:錯誤從遠程服務器
的Apache/2.2.15(紅帽)服務器讀數app-servername.rhcloud.com端口80
但是,如果在前面的代碼我刪除s
from https:// ...
像這樣http://android.googleapis.com/gcm/send
請求發送沒有問題,但我不能允許修改,因爲我還需要訪問其他需要SSL的地址。
我也與其他https
地址進行測試,但它是同樣的結果
在互聯網上搜索,我發現解決更新捲曲,但我不知道這是我的解決方案,自代碼上週正確執行https請求。反正我離開這裏的curl --version
響應我的服務器上:
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
有沒有一種方法來測試,實際上是一個捲曲的問題?這將幫助我知道如何找到解決方案。
我也認爲,但如果我嘗試訪問這樣的貝寶 $ ch = curl_init(https://www.paypal.com/home);也阻止它 – Sebastian
有沒有辦法來測試,實際上,是一個捲曲問題? – Sebastian