Skip to content
조회 수 17773 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

사이트 긁어오기


http://www.moonseller.net/273


현재 내가 발견한 사이트 긁어오기가 안되는 사이트의 유형은 세가지다. 세션을 물고 들어가야지만 페이지가 열리는 경우와 자기 자신의 도메인에서 오지 않을 경우 정상적인 접근이 아니라고 하는 경우 , 그리고 특정 국가의 아이피를 아예 차단시킨경우다.


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을 가져오는 방법.



<?
$szServer = "www.naver.com";
  $fp  = fsockopen($szServer, 80, $errorno, $errstr, 30);
  // Getting string
  $string = "";
  if(!$fp){
   echo "$errstr ($errno)<br>\n";
}else{
   fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
 while(!feof($fp)) {
   $string .= fgets($fp, 128);
 }
 fclose($fp);
}
  echo "<textarea>$string</textarea>";
?>


헤더까지 받아오므로 헤더는 적절히 잘라주세요.


iframe의 src값을 받아오려면 받아온 $string을 적절하게 검색하시면 됩니다.


<?
$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;
?>


또한 받아온 iframe의 src의 내용을 받으실라면 src를 받은 $szFrame으로 소켓을 여시면됩니다.



http://anipage.tistory.com/517






 웹페이지 자동 로긴해서 긁어 오기와 HTML 파싱 라이브러리

http://gnusdm.egloos.com/91945



Autosurf 소스 받기
autosurf.php 내용 보기
Html Parse 소스 받기






로그인 후 댓글쓰기가 가능합니다.

?

  1. 09
    Jan 2012
    09:09

    PC에서 스마트폰 원격제어하는 프로그램

    Category컴퓨터잡담 Views5938
    Read More
  2. 30
    Jun 2012
    08:14

    PDF, EXCEL 파일 변환

    CategoryExcel Views19810
    Read More
  3. 10
    Apr 2011
    12:46

    PF사용...페이징 중지를 통한 시스템 성능개선

    Category프로세스 Views30916
    Read More
  4. 07
    Mar 2016
    23:25

    PHP Opcache 속도개선 시키기

    CategoryServer Views1833
    Read More
  5. 07
    Mar 2016
    23:40

    PHP Opcache 적용 전과 후의 비교

    CategoryServer Views1325
    Read More
  6. 20
    Apr 2013
    08:08

    PHP Proxy 가져오기

    CategoryServer Views14181
    Read More
  7. 29
    Sep 2010
    18:20

    PHP Text to Image

    Category컴퓨터잡담 Views13954
    Read More
  8. 05
    Mar 2016
    09:15

    PHP 가속기

    CategoryServer Views540
    Read More
  9. 18
    Mar 2010
    16:03

    PHP 변수를 자바로 전송후 HTML로 뿌려주기

    Category컴퓨터잡담 Views23364
    Read More
  10. 31
    Aug 2011
    01:19

    PHP 스누피로 사이트 긁어오기가 되지 않는 사이트를 긁어오는 3가지 방법

    Category컴퓨터잡담 Views17773
    Read More
  11. 06
    Aug 2009
    15:11

    PHP 시간관련 함수

    Category컴퓨터잡담 Views21208
    Read More
  12. 28
    Nov 2009
    09:00

    php 에서 mysql 제어하기

    Category컴퓨터잡담 Views28200
    Read More
  13. 17
    Oct 2009
    08:38

    php 이미지 저장 및 이미지크기를 줄여 저장기술 소스

    Category컴퓨터잡담 Views14232
    Read More
  14. 28
    Feb 2013
    10:24

    PHP) Proxy 서버를 이용해서 원격 웹서버 내용 갖고 오기

    CategoryVisual C++ Views21868
    Read More
  15. 02
    Apr 2013
    07:16

    php) curl_setopt의 옵션

    CategoryServer Views12939
    Read More
  16. 02
    Apr 2013
    12:10

    PHP) Example #1 HTML 엔티티 디코딩

    CategoryServer Views10179
    Read More
  17. 23
    Mar 2013
    12:19

    php) register_globals = on 으로 설정할 수 없는경우

    CategoryServer Views8521
    Read More
  18. 04
    Mar 2013
    11:12

    PHP) Web Proxy Server 만들기 소스

    CategoryServer Views15140
    Read More
  19. 25
    Aug 2012
    14:33

    PHP) 다음 로그인 방식이 바뀌었군.

    Category컴퓨터잡담 Views6295
    Read More
  20. 23
    Mar 2013
    12:23

    php) 변수명을 변수값으로 지정방법

    CategoryServer Views8280
    Read More
Board Pagination Prev 1 ... 12 13 14 15 16 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소