0
當我輸入到我的瀏覽器:「https://myemail:[email protected]/v3/account」嘗試發送GET請求與捲曲hellosign API
我得到
{"account":{"account_id":"**************","email_address":"myemail","callback_url":null,"role_code":null}}
這似乎是一個有效的響應。
我想在PHP中使用libcurl php庫實現這個。我有以下內容,但是當我在$ response變量上運行var_dump時會得到FALSE。任何有關libcurl設置的想法?我已經嘗試urlencoding整個字符串有和沒有base_64編碼的認證子字符串myemail:mypassword。在此先感謝:
$final_string= 'https://myemail:[email protected]/v3/account';
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERAGENT, 'HelloSign-PHP');
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($curl, CURLOPT_URL, $final_string);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, self::$time_out);
$response = curl_exec($curl);
// Get the status code
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if(curl_exec($curl) === false)
{
echo 'Curl error: ' . curl_error($curl);
}
else
{
echo 'Operation completed without any errors';
}
curl_close($curl);
output is :
Curl error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failedProblem connecting to HelloSign.
當你說你沒有迴應時,你是什麼意思? 'curl_exec()'返回'false'? 'curl_error()'得到什麼?它應該給你一個錯誤指示。 –
對不起,我回去檢查,實際上是一個布爾 - 虛假正在生產 – user61629
由於用戶名和密碼是內聯的,你可以實際使用一個套接字函數。 ''echo'file_get_contents('https:// myemail:[email protected]/v3/account');' – Nadh