스누피로 파싱되지 않는 사이트 긁어오는 방법
페이지 정보
작성자 서방님 댓글 0건 조회 165회 작성일 16-10-11 11:46본문
1. 세션을 물고 들어가야 하는 경우
스누피 fetch 하기전에 아래와 같이 세션값을 임의로 먹여준다.
$snoopy->cookies["SessionID"] = 세션값;
2. 자기 자신의 도메인으로 부터 들어오지 않으면 막아버리는 경우
위와 마찬가지로 fetch 하기전에 아래와 같이 값을 먹여준다.
$snoopy->referer = “접속한 도메인";
3. 외국 사이트가 한국 ip를 아예 차단한 경우
http://nntime.com/proxy-country/United-States-01.htm
www.cybersyndrome.net/plr5.html
위 사이트들에서 좋은 프록시 서버를 찾았으면 아래와 같이 세팅해준다.
$snoopy->proxy_host =
“프록시서버";
$snoopy->proxy_port = "프록시 서버 포트번호";
네이버
카페에의 글 목록의 소스를 가져와서 파싱,
iframe을 가져오는
방법.
$iFrameIndex = stripos($string, "<iframe"); if($iFrameIndex !== false){ $iFrameEndIndex = stripos($string, ">", $iFrameIndex); $szFrame = substr($string, $iFrameIndex, $iFrameEndIndex - $iFrameIndex + 1); $iSrcIndex = stripos($szFrame, "src"); $szFrame = substr($szFrame, $iSrcIndex+4); if(substr($szFrame, 0, 1) == "\""){ $iSrcIndex = 1; $iSrcEndIndex = stripos($szFrame, "\"", 1) - 1; }else if(substr($szFrame, 4, 1) == "'"){ $iSrcIndex = 1; $iSrcEndIndex = stripos($szFrame, "'", 1) - 1; }else{ $iSrcIndex = 0; $iSrcEndIndex = stripos($szFrame, " ", 1); } if($iSrcEndIndex === false){ $szFrame = substr($szFrame, $iSrcIndex); }else{ $szFrame = substr($szFrame, $iSrcIndex, $iSrcEndIndex); } } echo $szFrame;
댓글목록
등록된 댓글이 없습니다.