用curl采集需要登录的页面

登陆cookie存储至自定义目录

$cookie_dir = tempnam('.', 'cookie');
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_dir);

二次采集时调用

curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_dir);//读取cookie文

原文地址:https://www.cnblogs.com/myblog1314/p/3547657.html