curl ÇÔ¼ö¸¦ ÀÌ¿ëÇÑ HTTP REFERER º¯°æ |
|
|
![](icon/private_name/1.gif) |
6³â Àü |
<?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "È£ÃâÇÒ ÆÄÀÏ.php");
curl_setopt($ch, CURLOPT_REFERER, "º¯°æÇÒ ¸®ÆÛ·¯ URL");
curl_exec($ch);
curl_close($ch);
?><div class='small'>REFERER º¯°æ</div>
curlÀ» »ç¿ëÇÒ ¼ö ¾ø´Â °æ¿ì¶ó¸é
´ÙÀ½ÀÇ ¹æ¹ýÀ¸·Îµµ ¸®ÆÛ·¯¸¦ ¼ÓÀϼö ÀÖ½À´Ï´Ù.
¹°·Ð fileÀ̳ª fopen ´ë½Å »ç¿ëÇÒ¼öµµ ÀÖ½À´Ï´Ù.
¾Æ·¡ÀÇ ¼Ò½º¸¦ ÆÄÀÏ·Î ¸¸µé¾î¼ ÀúÀåÇÑ´ÙÀ½
Àоî¿Ã Å×½ºÆ® ÆÄÀϵµ Çϳª ¸¸µì´Ï´Ù. ±× ÆÄÀϳ»¿¡ <?=$_SERVER['HTTP_REFERER']?> ¶ó°í ³Ö°í ÀúÀåÇÕ´Ï´Ù.
ÀÌÇÏ ¼Ò½ºÀÔ´Ï´Ù.
<?php
$url = "http://82da.com/Ybbs/sample/fsockopen_test.php";//Àоî¿Ã url
$referer = "http://test.com/";//¼ÓÀÏ ¸®ÆÛ·¯
$array = parse_url($url);
$url_scheme = $array['scheme'];
$url_server = $array['host'];
$url_path = $array['path'];
$url_query= $array['query'];
$url_port = (empty($array['port'])) ? 80 : $array['port'];
$fp = fsockopen($url_server, $url_port);
if (empty($fp)) {
echo "error-http¼ÒÄÏÁ¢¼Ó¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.";
exit;
}
fputs($fp, "GET " . $url_path . "?" . $url_query . " HTTP/1.0\n");
fputs($fp, "Accept: */*\n");
fputs($fp, "Content-Type: application/x-www-form-urlencoded\n");
fputs($fp, "Host: $url_server:$url_port\n");
fputs($fp, "Referer: $referer\n");
fputs($fp, "Cache-control: private\n");
fputs($fp, "Pragma: no-cache\n");
fputs($fp, "Connection: close\n\n");
$text = '';
while (!feof($fp)){
$text .= fgets($fp, 1024);
}
fclose($fp);
echo $text;
?> |
|
̵̧ : 276 |
̵̧
¸ñ·Ï
|
|