2020
10-08
10-08
PHP如何获取Cookie并实现模拟登录
一、定义Cookie存储路径必须使用绝对路径$cookie_jar=dirname(__FILE__)."/pic.cookie";二、获取Cookie将cookie存入文件$url="http://1.2.3.4/";$ch=curl_init();curl_setopt($ch,CURLOPT_URL,$url);curl_setopt($ch,CURLOPT_HEADER,0);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_jar);$content=curl_exec($ch);curl_close($ch);三、模拟浏览器获取验证码该服务器...
继续阅读 >