탐색시간의 블로그

프로그램

<?
$host = "www.naver.com"; //접속하고자하는 도메인
$port = "80"; //일반적인 웹서버포트
$fullpath = "http://www.naver.com/index.html"; // 검색하고자 하는 페이지의 도메인 포함 전체 주소
if(!($fp = fsockopen($host, $port, &$errno, &$errstr, 30))) // URL에 소켓 연결
{
return array(1,"소켓에러 - 검색이 중지됨", "9");
exit;
}

fputs($fp, "GET ".$fullpath." HTTP/1.0\r\n"."Host: $host:${port}\r\n"."User-Agent: Web 0.1\r\n"."\r\n"); // 서버에 URL 페이지 요청

while( !feof( $fp ) ) // 페이지내 모든 내용을 저장
{
$output .= fgets( $fp, 1024 );
}
echo $output;
?>

Posted by 씨크타임