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

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

· 7년 전 · 8545 · 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 환경입니다.
감사합니다
이걸 원하는곳에 적용시키는 방법을 알고 싶어요.완전 생초짜입니다 충성

게시글 목록

번호 제목
24318
24317
24315
24309
24294
24293
24277
24262
24260
24253
24251
24236
24233
24228
24226
24221
24214
24203
24201
24199
24196
24195
24194
24192
24191
24187
24185
24183
24172
24168