BACKRUSH  대화방입장  유닉스명령  다음  자료실  Ascii Table   Exploit   원격접속  달력,시간   프로세스  
지하철노선   Whois   RFC문서   SUN FAQ   SUN FAQ1   C메뉴얼   PHP메뉴얼   너구리   아스키월드 아이피서치

글쓴이: PHP GET/POST 전송 조회수: 7452



[ get 방식 ]



<?

$server = "itn.pe.kr";

$port = 80;

$method = "get";


$path = "/method_test.php";

$header = array();

$variable = array();

$config = array("version" => "1.0","name" => "Get files through http protocol","debugname" => "http_method.php");

$header["Accept"] = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";

$header["Referer"] = "/";

$header["Accept-Language"] = "ko";

$header["Content-Type"] = "application/x-www-form-urlencoded";

$header["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)";

$header["Host"] = $server;

$header["Connection"] = "Keep-Alive";

$header["Cache-Control"] = "no-cache";


$variable["test_data"] = "Translation complete!";


$sock = @fsockopen($server, $port);

if (!$sock) $Error("Cannot open socket [$server:$port]");


if ($variable) {

$aid_url = "?";

foreach ($variable as $key => $value) {

$key = urlencode($key);

$value = urlencode($value);

if ($aid_url == "?") $aid_url .= $key."=".$value;

else $aid_url .= "&".$key."=".$value;

}

}


$cmd = "GET ".$path.$aid_url." HTTP/1.1";

if (!$header) $Error("No Any HTTP Headers.");


foreach ($header as $key => $value) {

$cmd .= "\r\n".$key.": ".$value;

}


$cmd .= "\r\n\r\n";

fputs($sock, $cmd);

$str_get = "";


while (!feof($sock)) {

$str_get .= fgets($sock, 1024);

}


echo("$str_get");

?>


[ POST 방식 ]


<?

$server = "itn.pe.kr";

$port = 80;

$method = "post";

$path = "/method_test.php";

$header = array();

$variable = array();

$config = array("version" => "1.0","name" => "Get files through http protocol","debugname" => "http_method.php");

$header["Accept"] = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";

$header["Referer"] = "/";

$header["Accept-Language"] = "ko";

$header["Content-Type"] = "application/x-www-form-urlencoded";

$header["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)";

$header["Host"] = $server;

$header["Connection"] = "Keep-Alive";

$header["Cache-Control"] = "no-cache";


$variable["test_data"] = "Translation complete!";


$sock = @fsockopen($server, $port);

if (!$sock) $Error("Cannot open socket [$server:$port]");


if ($variable) {

$aid_query = "";


foreach ($variable as $key => $value) {

$key = urlencode($key);

$value = urlencode($value);

if (!$aid_query) $aid_query .= $key."=".$value;

else $aid_query .= "&".$key."=".$value;

}

}


$cmd = "POST ".$path." HTTP/1.1";

if (!$header) $Error("No Any HTTP Headers.");


$strlen = strlen($aid_query);

$header["Content-Length"] = $strlen;


foreach ($header as $key => $value) {

$cmd .= "\r\n".$key.": ".$value;

}


$cmd .= "\r\n\r\n";

$cmd .= $aid_query;


fputs($sock,$cmd);

$str_get = "";


while (!feof($sock)) {

$str_get .= fgets($sock, 1024);

}


echo("$str_get")

?>




관련글 : 없음 글쓴시간 : 2008/10/05 23:36 from 119.196.113.10

  [응답]php으로 작업관리자를 만들려고 하는데요 목록보기 새글 쓰기 지우기 응답글 쓰기 글 수정 http 접속  CLASS[php]  
BACKRUSH  대화방입장  유닉스명령  다음  자료실  Ascii Table   Exploit   원격접속  달력,시간   프로세스  
지하철노선   Whois   RFC문서   SUN FAQ   SUN FAQ1   C메뉴얼   PHP메뉴얼   너구리   아스키월드 아이피서치