我正在使用cURL PHP尝试使用标头发出GET请求。我从服务器得到一个空的响应。我想知道我是否使用cURL PHP正确地提出了这个请求。
// curl GET request with headers
$url = $sendMailURL;
$requestHeaders = array(
$hConLength_.':'.$conLengthValue,
$hConType_.':'.$conTypeValue,
$hHost_.':'.$conHostValue,
$hDate_.':'.$conAmzDateValue);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
if(curl_error($ch)){
echo 'curl error: '.curl_error($ch);
}else{
print_r($output);
}
的print_r($ requestHeaders):
Array ( [0] => Content-Length:207 [1] => Content-Type:application/x-www-form-urlencoded [2] => Host:email.eu-west-1.amazonaws.com [3] => X-amz-date:20180115T224433Z )