复制代码 代码如下: $postData = "username=your_name&password=your_password&Submit=Login"; $posturl = "http://......../../login.jsp"; $postUrl = parse_url($posturl); $host = $postUrl[host] ? $postUrl[host] : ""; $port = $postUrl[port] ? $postUrl[port] : 80; $path = $postUrl[path] ? $postUrl[path] : "/"; $fsp = fsockopen($host, $port, &$errno, &$errstr, 30); if(!$fsp){ print "\nopen socket failed\n"; }else{ fwrite($fsp, "POST ".$path." HTTP/1.1\r\n"); fwrite($fsp, "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n"); fwrite($fsp, "Accept-Language: zh-cn\r\n"); fwrite($fsp, "Content-Type: application/x-www-form-urlencoded\r\n"); fwrite($fsp, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)\r\n"); fwrite($fsp, "Host:".$host."\r\n"); fwrite($fsp, "Content-Length: ".strlen($postData)."\r\n\r\n"); fwrite($fsp, $postData); $resp = ""; do{ if(strlen($out=fread($fsp, 1024)) == 0) break; $resp .= $out; }while(true); echo "
".nl2br($resp); fclose($fsp); } ?>
以上就介绍了DataReader使用 如何使用脚本模仿登陆过程,包括了DataReader使用方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
相关文章
相关视频
|