简体   繁体   English

PHP Set-Cookie 在标题中用于下一个请求

[英]PHP Set-Cookie in the header for next request

I send a request to the server using php curl,i am getting the server response like:我使用 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
 )

In the next request i have to send this session ID for sending the XML.But i don't know how i can send that Session ID through header using CURL Method.在下一个请求中,我必须发送此会话 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM