php模拟登陆的实现方法,这里分别列举两种方法实现模拟登陆人人网。具体实例代码如下:
(1)使用snoopy模拟登陆
referer='http://www.renren.com/'; $snoopy->agent="Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20100101 Firefox/22.0"; $submit_vars['email'] ='登陆账号'; $submit_vars['password'] ='登陆密码'; $url='http://www.renren.com/PLogin.do';//登陆数据提交的URL地址 $snoopy->submit($url,$submit_vars); $snoopy->fetch("http://www.renren.com/");//希望获取的页面数据 echo $snoopy->results;//www.phpernote.com
(2)使用curl模拟登陆
Copy after login