正如你们所知道的,您可以通过Curl请求发送cookie。下面是一个例子:
<?php
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
/* get cookies from an existing file */
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt");
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
?>
但是/tmp/cookies.txt的格式是什么呢
谢谢!
发布于 2021-07-08 20:50:28
Netscape cookie文件格式是基于文本的,每行存储一个cookie。以#开头的行将被视为注释。指定单个cookie的每一行由七个用TAB字符分隔的文本字段组成。有效行必须以换行符结尾。
#domain Include Subdomains Path Secure Expires at Name Value
.example.com TRUE / TRUE 1628330848 id 1234安全:仅通过HTTPS发送/接收。
过期时间:自1970年1月1日起的秒数,对于会话cookies,则为0。
https://stackoverflow.com/questions/50796681
复制相似问题