실제로 JavaScript에 의해 설정되고 원래 이미지로 리디렉션되는 쿠키입니다. 문제는 curl/fgc가 html을 파싱하지 않고 curl이 쿠키 항아리에 저장할 서버가 설정 한 쿠키 만 설정한다는 것입니다.
이
는 리디렉션하기 전에 얻을 코드, 그것은 어떤 이름으로 자바 스크립트를 통해 쿠키를 만들지 만입니다 같이 location.href 값으로 :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HEAD>
<TITLE>http://phim.xixam.com/thumb/giotdang.jpeg</TITLE>
<meta http-equiv="Refresh" content="0;url=http://phim.xixam.com/thumb/giotdang.jpeg">
</HEAD>
<script type="text/javascript">
window.onload = function checknow() {
var today = new Date();
var expires = 3600000*1*1;
var expires_date = new Date(today.getTime() + (expires));
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("safari") != -1) { document.cookie = "location.href"; } else { document.cookie = "location.href;expires=" + expires_date.toGMTString(); }
}
</script>
<BODY>
</BODY></HTML>
그러나 모든 때문에 미리 설정에 의해, 손실되지 않습니다/쿠키를 위조하면이 보안 조치를 피할 수 있습니다 (모든 종류의 보안을 위해 쿠키를 사용하는 것이 나쁜 이유).
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
phim.xixam.com FALSE /thumb/ FALSE 1338867990 location.href
그래서 같은 보일 것이다 적어서 컬 스크립트 cookie.txt : 크롤러를 중지 할 수있는 유일한 방법
<?php
function curl_get($url){
$return = '';
(function_exists('curl_init')) ? '' : die('cURL Must be installed!');
//Forge the cookie
$expire = time()+3600000*1*1;
$cookie =<<<COOKIE
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
phim.xixam.com FALSE /thumb/ FALSE $expire location.href
COOKIE;
file_put_contents(dirname(__FILE__).'/cookie.txt',$cookie);
//Browser Masquerade cURL request
$curl = curl_init();
$header[0] = "Accept: text/xml,application/xml,application/json,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: ";
curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
curl_setopt($curl, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0 Firefox/5.0');
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_HEADER, 0);
//Pass the referer check
curl_setopt($curl, CURLOPT_REFERER, 'http://xixam.com/forum.php');
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$html = curl_exec($curl);
curl_close($curl);
return $html;
}
$image = curl_get('http://phim.xixam.com/thumb/giotdang.jpeg');
file_put_contents('test.jpg',$image);
?>
가 데이터베이스에있는 모든 방문자의 IP를 기록하는 것입니다 ip 당 방문수를 기준으로 값을 증가시킨 다음 1 주일에 한 번 ip로 상위 히트 수를 확인한 다음 ip의 역방향 조회를 수행하고 호스팅 제공 업체가 방화벽이나 htaccess에서 차단하는지 확인합니다 , 그때 그쪽으로 어떤 장애물이라도 공개적으로 사용 가능하다면 리소스 요청을 실제로 중단 할 수는 없습니다.
희망이 있습니다.
도둑질하지 마십시오, 문제 해결 :-) –
@ 대각선 BTW, 이것은 미치광이가 아닙니다. 나는 단지 호기심이 xD' –
왜냐하면 당신이 그것을 말하기 때문에, 나는 그것이 당신을 믿는다는 것을 의미하지 않는다. –