以下のコードを書きましたが、curl 応答を取得できません。以下のデバッグ情報について言及しました。
なぜこの問題のcurl_execがfalseを返すのかを調べるのを手伝ってもらえますか.
$jwtToken = getToken();
$service_url = "https://example.com/api/Demo/GetProjectAttributes/1484";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $service_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_HTTPHEADER, array (
"Content-Type: application/x-www-form-urlencoded",
"Authorization: Bearer $jwtToken"
) );
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/mycert.crt");
$response = curl_exec($ch);
if ($response === false ) {
$info = curl_getinfo($ch);
echo '<pre>';
die('error occured during curl exec. Additioanl info: ' . var_export($info));
curl_close($ch);
}
カールが失敗し、以下の情報が表示されます:
array (
'url' => 'https://example.com/api/Demo/GetProjectAttributes/1484',
'content_type' => NULL,
'http_code' => 0,
'header_size' => 0,
'request_size' => 0,
'filetime' => -1,
'ssl_verify_result' => 0,
'redirect_count' => 0,
'total_time' => 0.57699999999999996,
'namelookup_time' => 0,
'connect_time' => 0.28100000000000003,
'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' => '104.209.135.21',
'certinfo' =>
array (
),
'primary_port' => 443,
'local_ip' => '192.168.1.4',
'local_port' => 56491,
)