有人可以解释CURL cookie处理(PHP)吗? [英] Can someone explain CURL cookie handling (PHP)?

查看:189
本文介绍了有人可以解释CURL cookie处理(PHP)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

老实说,我在理解CURL选项CURLOPT_COOKIEFILE和CURLOPT_COOKIEJAR时遇到了一些麻烦。

honestly I'm having some trouble understanding the CURL options CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR.

如果我设置

curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt')
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt')

cookie.txt在哪里创建?在服务器上?在哪个目录?

Where is cookie.txt created? On the server? In which directory?

最愚蠢的问题:
会处理curl脚本执行的所有请求吗?所以,如果我有200个请求,CURL是否存储所有请求cookie信息在一个单独的文件中为alle 200请求?

And the most stupid question: does this handle all requests the curl-script is executing? So, if I have 200 requests, does CURL store all the request cookie information in a single file for alle 200 requests?

也许有人可以快速概述这如何工作,我没有找到一个很好的教程,这篇文档是相当差。

Maybe someone can give me quick overview how this works, I didn't find a good tutorial on this and the documentation is quite poor.

推荐答案

cookie.txt是在同一个目录作为您的PHP脚本。对于每个新的curl句柄,cookie.txt都被覆盖。

cookie.txt is on the same directory as your PHP script. cookie.txt is overwritten for every new curl handle.

这篇关于有人可以解释CURL cookie处理(PHP)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆