[1원팁] 네이버 실시간 검색어 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개