drzablspw01655860 2015-06-15 10:43
浏览 86
已采纳

用于下一个请求的标头中的PHP Set-Cookie

I send a request to the server using php curl,i am getting the server response like:

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.

  • 写回答

1条回答 默认 最新

  • duandeng2265 2015-06-15 11:37
    关注
     curl_setopt($ch, CURLOPT_COOKIE, session_name().'='.session_id()); 
    
    or
    
    
    
     curl_setopt($ch, CURLOPT_COOKIE, $cookie); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝