我正在尝试从引用中解析一些数据。 Cookie值是必要参数之一,更准确地说是它的下一个值:
Cookie: ipp_uid2=efliElW4ac8ZN1ij/Z/HcwOZTR8GjhSAoyZq96A==;
ipp_uid1=1551805782684; ipp_key=v1551805782684/v3394bd6affd4485fec9704163aeca6afa04ab3/GUF3kfsYsBwa3cRGpzpV2g==;
我是从谷歌浏览器的“隐身”中“手动”获得的。它每小时更改一次,我想自动获取。没有这些值,curl查询将不起作用。
我如何通过使用curl或其他自动方式获得theese值?
查询代码:
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $task);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Cookie: ipp_uid2=efliElW4ac8ZN1ij/Z/HcwOZTR8GjhSAoyZq96A==; ipp_uid1=1551805782684; ipp_key=v1551805782684/v3394bd6affd4485fec9704163aeca6afa04ab3/GUF3kfsYsBwa3cRGpzpV2g==;",
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$server_output = curl_exec($ch);
echo $server_output;
curl_close ($ch);