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);
 
2018/07/25 20:48 2018/07/25 20:48

Trackback Address :: https://youngsam.net/trackback/1902