我正在尝试卷曲页面(server.php)并在标题中发送三个变量($webServiceId $hash 和 $timestamp),如下所示。如何从 server.php 的标头中获取两个变量,以便处理它们并发送响应?我试过用谷歌搜索和搜索here,但我似乎无法找出方法。
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'server.php');
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: URL-Encoded-API-Key {$webServiceId},{$hash},{$timestamp}"));
$response = curl_exec($ch);
curl_close ($ch);
// dump response
print_r( $response );
如果 server.php 通过响应回显其收到的标头,则 $response 的 print_r 产生:
HTTP/1.1 200 OK Date: Thu, 02 Aug 2012 22:18:59 GMT Server: LiteSpeed Connection: close X-Powered-By: PHP/5.3.14 Allow: GET
Authorization: URL-Encoded-API-Key 不在那里。我可以错误地设置卷曲标题吗?