Judul : Grab Youtube Php API V3
link : Grab Youtube Php API V3
Grab Youtube Php API V3
Grab Youtube Php API V3, menggunakan curl tentu sangat membantu dalam grab sebuah website. Implementasinya akan dibahas pada web sedot code.function ngegrab($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$uaa = $_SERVER['HTTP_USER_AGENT'];
curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: $uaa");
return curl_exec($ch);
}
function search_video_ytb($kw,$api,$num='5'){
$kw = urlencode($kw);
$grab = ngegrab('https://www.googleapis.com/youtube/v3/search?key=' . $api . '&part=snippet&order=relevance&maxResults='.$num.'&q=' . $kw . '&type=video');
$json = json_decode($grab);
return $json;
}
function detail_video_ytb($api,$idvideo){
return ngegrab('https://www.googleapis.com/youtube/v3/videos?key=' . $api . '&part=contentDetails,statistics&id=' . $idvideo . '');
}
Baca juga:
- Contoh Penggunaan CURL Untuk Grab Video Youtube Api v3 Part 1
- WikiDefinition, Wiki Definition Php Function
- Menghapus Karakter Tertentu Dengan PHP Bagaimana Menghapus Simbol-Simbol
Demikianlah Artikel Grab Youtube Php API V3
Sekianlah artikel Grab Youtube Php API V3 kali ini, mudah-mudahan bisa memberikan manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel berikutnya.
Anda sekarang membaca artikel Grab Youtube Php API V3 dengan alamat link https://lapak-code.blogspot.com/2017/03/grab-youtube-php-api-v3.html