[英]PHP Set-Cookie in the header for next request
我使用 php curl 向服務器發送請求,我收到服務器響應如下:
Array
(
[0] => HTTP/1.1 200 OK
[1] => Connection: close
[2] => Date: Mon, 15 Jun 2015 10:34:22 GMT
[3] => Server: Microsoft-IIS/6.0
[4] => X-Powered-By: ASP.NET
[5] => X-AspNet-Version: 1.1.4322
[6] => Set-Cookie: ASP.NET_SessionId=qqvn5y55p2cwqkmkdt5z1455; path=/
[7] => Cache-Control: private, max-age=0
[8] => Content-Type: text/xml; charset=utf-8
[9] => Content-Length: 1379
)
在下一個請求中,我必須發送此會話 ID 以發送 XML。但我不知道如何使用 CURL 方法通過標頭發送該會話 ID。
curl_setopt($ch, CURLOPT_COOKIE, session_name().'='.session_id());
or
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.