파싱과 프록시 문의드립니다..

· 12년 전 · 2296
파싱을 하던 사이트가 있었는데 갑자기 파싱이 안되네요..

소스구조가 달라진 게 아닌걸 보니 아이피 차단을 한것 같습니다..

프록시를 사용하면 될것 같다는 생각이 드는데..

기존 코드에 프록시를 어떻게 적용해야 되는지 모르겠습니다..


------ 기존 코드 中 ------

function get_page($url,$utf8="1",$post="0",$params="")
{
global $ch;

if($post){
curl_setopt($ch, CURLOPT_POST,true);
if($params) curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HTTPGET,false);
}else{
if($params) $url = $url.http_build_query($params);
curl_setopt($ch, CURLOPT_POST,false);
curl_setopt($ch, CURLOPT_HTTPGET,true);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_AUTOREFERER, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookiefile');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookiefile');
$res = curl_exec($ch);

if($utf8) $res = iconv("euckr","utf8",$res);

return $res;
}

---------------------------

위 부분쯤에 적용을 하면 될것 같은데 방법을 잘 모르겠습니다..

혹시 적용할줄 아시는 분 계신가요??
|
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
12년 전 조회 2,163
12년 전 조회 1,897
12년 전 조회 2,390
12년 전 조회 2,087
12년 전 조회 1,907
12년 전 조회 1,874
12년 전 조회 2,169
12년 전 조회 2,148
12년 전 조회 2,087
12년 전 조회 2,297
12년 전 조회 2,548
12년 전 조회 1,937
12년 전 조회 2,122
12년 전 조회 2,092
12년 전 조회 1,822
12년 전 조회 3,330
12년 전 조회 1,907
12년 전 조회 1,713
12년 전 조회 1,809
12년 전 조회 2,071