$postData = "username=your_name&password=your_password&Submit=Login";
$posturl = "http://......../../login.jsp";
$postUrl = parse_url($posturl);
$host = $postUrl[host] ? $postUrl[호스트] : "";
$port = $postUrl[port] ? $postUrl[포트] : 80;
$path = $postUrl[path] ? $postUrl[경로] : "/";
$fsp = fsockopen($host, $port, &$errno, &$errstr, 30);
if(!$fsp){
'소켓 열기 실패' 인쇄;
}else{
fwrite($fsp, "POST ".$path." HTTP/1.1rn");
fwrite($fsp, "수락: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms -powerpoint, 애플리케이션/msword, */*rn");
fwrite($fsp, "Accept-Language: zh-cnrn");
fwrite($fsp, "콘텐츠 유형: application/x-www-form-urlencodedrn");
fwrite($fsp, "사용자 에이전트: Mozilla/4.0 (호환; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)rn");
fwrite($fsp, "호스트:".$host."rn");
fwrite($fsp, "콘텐츠 길이: ".strlen($postData)."rnrn");
fwrite($fsp, $postData);
$resp = "";
do{
if(strlen($out=fread($fsp, 1024)) == 0) break;
$resp .= $out;
}동안(true);
에코 "
".nl2br($resp);
fclose($fsp);
}
?>
DataReader를 사용하는 방법은 다음과 같습니다:助。