简体   繁体   English

PHP curl重置或修改Cookie

[英]php curl reset or modify cookies

PHP-CURL: How the hell can I modify or delete cookies after calling curl_exec in existing curl object? PHP-CURL:在现有curl对象中调用curl_exec后,如何修改或删除cookie?

1) "Cookiejar" file is not saved on disk until curl_close()! 1)直到curl_close()才将“ Cookiejar”文件保存在磁盘上!

2) CURLOPT_COOKIE - can't help, just adding cookie with same name, not removing/editing older one. 2)CURLOPT_COOKIE-无法提供帮助,仅添加具有相同名称的cookie,而不删除/编辑较旧的cookie。

3) CURLOPT_HTTPHEADER - setting "Cookie: " - can't help too! 3)CURLOPT_HTTPHEADER-设置“ Cookie:”-也无济于事!

I just need to edit or totally remove that cookies without closing - re-creating curl object =( 我只需要编辑或完全删除该cookie而不关闭-重新创建curl对象=(

I think I had similar problem. 我想我也有类似的问题。 Solution was cloning curl object with curl_copy_handle() and closing one of them (either original or clone). 解决方法是使用curl_copy_handle()克隆curl对象,然后关闭其中之一(原始副本或克隆副本)。 I'm not sure if this is useful for your problem. 我不确定这是否对您的问题有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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