【问题标题】:PHP Set-Cookie in the header for next request下一个请求的标头中的 PHP Set-Cookie
【发布时间】:2015-06-15 10:43:02
【问题描述】:

我使用 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());或 curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  • 谢谢 Ramki..我现在收到回复了..
  • 您可以根据我的这个答案调整代码,stackoverflow.com/a/13210186/1428679

标签: php curl soap


【解决方案1】:
 curl_setopt($ch, CURLOPT_COOKIE, session_name().'='.session_id()); 

or



 curl_setopt($ch, CURLOPT_COOKIE, $cookie); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-02
    • 2020-10-27
    • 1970-01-01
    • 1970-01-01
    • 2013-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多