정

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

· 2013-12-01 (일) 16:50:42 · 2383
파싱을 하던 사이트가 있었는데 갑자기 파싱이 안되네요..

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

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

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


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

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 질문답변

66,531건

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

+
제목 글쓴이 날짜 조회
13-12-02 조회 2,108
13-12-02 조회 1,905
13-12-02 조회 2,597
13-12-02 조회 1,815
13-12-02 조회 2,246
13-12-02 조회 1,990
13-12-01 조회 2,463
13-12-01 조회 2,179
13-12-01 조회 1,997
13-12-01 조회 1,975
13-12-01 조회 2,255
13-12-01 조회 2,235
13-12-01 조회 2,176
13-12-01 조회 2,384
13-12-01 조회 2,669
13-12-01 조회 2,031
13-12-01 조회 2,226
13-12-01 조회 2,200
13-11-30 조회 1,985
13-11-30 조회 1,809