在网上看到很多cURL的代码,很多fsockopen的代码,但是感觉都是把登陆页面放到本地,然后在本地进行一些下载、发帖之类的操作。我想要的是登录原来的亿邮系统,也就是说先传递登录参数,然后跳转到亿邮本身的页面?这是原来想要实现的意图,但是后来发现完全没有传递过去referer,有什么别的方法?<?
header("Referer:http://mail.cn/index.php",false);
header("Location:http://mail.cn/index.php?LoginName=xxx&Password=yyy");
?>
header("Referer:http://mail.cn/index.php",false);
header("Location:http://mail.cn/index.php?LoginName=xxx&Password=yyy");
?>
抓取页面后
在本地echo我不清楚你这个然后跳转是什么意思,如果说浏览器。那就毛得办法,只能用本地echo.
如果是IE的话,跳转的来源应该就是你自己的登陆URL。正确的做法是:$handle = fsockeopen("mail.cn", 80);
fputs($handle, "GET index.php?LoginName=xxx&Password=yyy HTTP/1.0\r\n");
fputs($handle, "Host: mail.cn\r\n");
fputs($handle, "Referer: http://mail.cn/index.php\r\n");while(!feof($handle)) {
echo fgets($handle);
}
fclose($handle);如果你对HTTP协议不熟悉的,建议使用CURL