Skip to content
컴퓨터잡담
2009.08.05 14:16

네이버 만화 PHP로 RSS 출력 만들기

조회 수 31786 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

네이버 만화 PHP로 RSS 출력 만들기


참고사이트 : http://comic.naver.com/main.nhn?order=StarScore


RSS 수집을 하기위해 PHP로 RSS출력하는 소스를 만들어 보았습니다.


출력 내용은 제목, 링크주소,내용(이미지) 3개로 구성했습니다.


우선 제로보드 XE의 수집기가 description안에 이미지를 찾아서 등록시키는 것으로


내용에 이미지를 넣었습니다만, 이미지를 별도로 하고 싶으시면


수정하시면 되겠죵?~ ㅋㅋㅋ;;






잘 나오는 것 같습니다.



만화 괜찮은 사이트 없나요? 쩝...


소스내용이 크롬에서는 잘보이는데 익스프롤러에서는 제대로 나오는지 모르겟습니다.


//=======================================================================================


<?
$now=time();

$a = file('http://comic.naver.com/main.nhn?order=StarScore');

$bae = 0;

for($i=0;$i<count($a);$i++)
 {$a[$i] = iconv("utf-8","euc-kr",$a[$i]);
 if(ereg('<h4 class="subtlt"><img src="./,$a[$i]) $cc = 1;
 if(ereg("<div class="cutTypeChal"><span>',$a[$i])) $cc = 0;

 if($cc == 1)
  {

  if(ereg('img src="./,$a[$i]) && ereg("a onclick',$a[$i]))
    {
    $imga = explode('img src="./,$a[$i]);
    $imga = explode(""',$imga[1]);
    $img[$bae] = $imga[0];
//    echo '<br />'.$bae.$img[$bae].'<br />';

    $linka = explode('href="./,$a[$i]);
    $linka = explode(""><img',$linka[1]);
    $link[$bae] = $linka[0];

    $titlea = explode('title="',$a[$i]);
    $titlea = explode('" w',$titlea[1]);
    $title[$bae] = $titlea[0];

//    echo $link[$bae];
//    echo $title[$bae];

    $bae++;
    }
  }
 } //for_end

 


$a = file('http://comic.naver.com/main.nhn?order=ViewCount');


for($i=0;$i<count($a);$i++)
 {$a[$i] = iconv("utf-8","euc-kr",$a[$i]);
 if(ereg('<h4 class="subtlt"><img src="./,$a[$i]) $cc = 1;
 if(ereg("<div class="cutTypeChal"><span>',$a[$i])) $cc = 0;

 if($cc == 1)
  {

  if(ereg('img src="./,$a[$i]) && ereg("a onclick',$a[$i]))
    {
    $imga = explode('img src="./,$a[$i]);
    $imga = explode(""',$imga[1]);
    $img[$bae] = $imga[0];
//    echo '<br />'.$bae.$img[$bae].'<br />';

    $linka = explode('href="./,$a[$i]);
    $linka = explode(""><img',$linka[1]);
    $link[$bae] = $linka[0];

    $titlea = explode('title="',$a[$i]);
    $titlea = explode('" w',$titlea[1]);
    $title[$bae] = $titlea[0];

//    echo $link[$bae];
//    echo $title[$bae];

    $bae++;
    }
  }
 } //for_end


//header('Content-Type: text/xml; charset=euc-kr');

$content .= '<?xml version="1.0"?>'.chr(13);
$content .= '<rss version="2.0"><channel xmlns:psl="http://rainbow.daum.net/psl"> '.chr(13);
$content .= '<title>네이버 만화</title> '.chr(13);
$content .= '<link>http://k.daum.net/qna/openknowledge/list.html?category_id=D</link> '.chr(13);
$content .= '<description>다음지식 오픈사전</description> '.chr(13);
$content .= '<pubDate></pubDate> '.chr(13);
$content .= '<language>ko</language> '.chr(13);
$content .= '<copyright>Copyright (c) Daum Communications. All rights reserved.</copyright> '.chr(13);
$content .= '<webMaster>wwwmaster@hanmail.net</webMaster> '.chr(13);
$content .= '<generator>Daum CMS</generator> '.chr(13);
$content .= '<docs></docs> '.chr(13);
$content .= '<ttl>18</ttl> '.chr(13);
$content .= '<image> '.chr(13);
$content .= '<url>http://image.daum-img.net/hanmail/top/2005f_top/daum.gif</url> '.chr(13);
$content .= '<title>Naver RSS</title> '.chr(13);
$content .= '<link>http://www.naver.com</link>'.chr(13);
$content .= '</image>'.chr(13);

 


for($i=0;$i<count($title);$i++)
 {

  $content .= '  <item>'.chr(13);

  $content .= '  <title>'.$title[$i].'</title>'.chr(13);
  $content .= '  <link>http://comic.naver.com'.htmlspecialchars($link[$i]).'</link>'.chr(13);
  $content .= '  <description>'.$title[$i].'&lt;img src="./&quot;".$img[$i].'&quot;&gt;</description>'.chr(13);

  $cate = explode(',',$tag[$i]);

  if($cate[0]) {$content .= '  <category>'.$cate[0].'</category>'.chr(13);}
  if($cate[1]) {$content .= '  <category>'.$cate[1].'</category>'.chr(13);}
  if($cate[2]) {$content .= '  <category>'.$cate[2].'</category>'.chr(13);}
  if($cate[3]) {$content .= '  <category>'.$cate[3].'</category>'.chr(13);}
  if($cate[4]) {$content .= '  <category>'.$cate[4].'</category>'.chr(13);}

//  for($ii=0;$ii<count($cate);$i++)
//   { echo '<category>'.$cate[$ii].'</category>'; }


  $content .= '  </item>'.chr(13).chr(13);
 }//for_end

 


$content .= '</channel>'.chr(13);
$content .= '</rss>'.chr(13);


print $content;


// $file_pointer = fopen("../../temp/daum_man_rss.xml", "w");
// $context = $content;
// fwrite($file_pointer, $context);
// fclose($file_pointer);

?>

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

?

List of Articles
번호 분류 제목 날짜 조회 수
877 AutoHotKey ahk) autohotkey 엑셀(Excel)에서 행값 증가시키기 2013.10.30 37410
876 파이썬 DiffusionWrapper has 859.52 M params. 2023.04.21 37148
875 AutoHotKey Autohotkey) Find WM_COMMAND parameter with Winspector 17 2012.02.22 35863
874 컴퓨터잡담 2023-09-23 서버다운 후 복구완료 secret 2023.09.23 35648
873 컴퓨터잡담 자바스크립트/CSS 트리를 이용한 예제 프로그램 쉽게만들기 2 2009.06.30 35631
872 컴퓨터잡담 .htaccess와 워터마킹을 이용한 이미지 링크 방지 2009.06.30 34917
871 AutoHotKey autohotkey) Virus? 6 2011.12.31 34677
870 AutoHotKey ahk) autohotkey 글자 자르기 방법 2013.10.30 34636
869 컴퓨터잡담 IPTIME N904 모델에서 멀티캐스트 프로토콜(IGMP) 설정하는 방법 file 2013.10.08 34236
868 컴퓨터잡담 옵티머스G 배터리 일체형은 절대 비추천합니다. 21 5 file 2012.09.18 34148
867 컴퓨터잡담 TIME_WAIT 줄이기(소켓이 부족하여 프로세스 강제중단을 막기위해) 4 2009.11.30 34107
866 AutoHotKey autohotkey) 오토핫키에서 자주쓰는 함수모음 2013.10.30 33652
865 컴퓨터잡담 네이버 많이 본 뉴스 PHP로 RSS 출력 만들기 1 file 2009.08.05 33649
864 AutoHotKey autohotkey) 30분마다 자동으로 디스크 정리하기 file 2013.07.31 33067
863 Visual C++ C# - etrade api site 게시물 1 2013.02.20 32885
862 컴퓨터잡담 CURL 을 이용한 GET/POST 값 넘기기 3 2009.06.30 32785
861 컴퓨터잡담 PHP로 FTP 접속 / 업로드 / 다운로드 등의 컨트롤 소스 2 3 2009.10.20 32741
860 컴퓨터잡담 현재 쿠키,세션 값 전부 보기 2009.06.30 32610
859 AutoHotKey ahk) 열려진 엑셀창의 값 불러오기 1 2013.10.30 32524
858 컴퓨터잡담 특정 파일을 제외한 현재 디렉토리 내의 모든 파일을 삭제하는 배치파일 2022.07.14 32395
Board Pagination Prev 1 2 3 4 5 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소