테스트 사이트 - 개발 중인 베타 버전입니다

[1원팁] 네이버 실시간 검색어 20개 추출

· 7년 전 · 8543 · 20

[code]

 

function NaverKeyWord(){
    $Curl = curl_init();
    curl_setopt($Curl, CURLOPT_URL, "https://datalab.naver.com/keyword/realtimeList.naver?where=main");
    curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($Curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    $Result = curl_exec($Curl);
    $RandList = explode("<ul class=\"rank_list\">", $Result);
    $RandList = explode("</ul>", $RandList[1]);
    $Rand[0] = explode("<span class=\"title\">", $RandList[0]);
    for($i=1; $i < count($Rand[0]); $i++){
    $Rand[1] = explode("</span>", $Rand[0][$i]);
        $ReturnData = trim(strip_tags($Rand[1][0]));
        if($ReturnData){
            $Return[] = $ReturnData;
        }
    }
    return $Return;
}
$NaverKeyWord = NaverKeyWord();
print_r($NaverKeyWord);

 

[/code]

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 20개

감사합니다
7년 전
@dkandkanehd 감사합니다.! 좋은하루되세요!
수고 하셨습니다.
7년 전
감사합니다.!!
아니 실시간 검색어 api가 없다는게 놀랍습니다.
7년 전
api가 있는지 사실 잘 모르겠습니다. ㅋ.ㅋ
7년 전
감사합니다.
혹시 php 버전이라든가 제한이 있나요? 혹시 서버 설정이라도? 전 PHP Version 7.0.16 환경입니다.
감사합니다
이걸 원하는곳에 적용시키는 방법을 알고 싶어요.완전 생초짜입니다 충성

게시글 목록

번호 제목
23606
23598
23585
23579
23578
23564
23550
23549
23548
23529
23510
23507
23481
23471
23453
23452
23450
23436
23428
23404
23396
23389
23380
23369
23350
23337
23317
23307
23298
23290