데모
<?php
//ver1.0 150423 @_untitle_d
$yt_api = ''; //유튜브 API KEY, https://console.developers.google.com/project
function get_video_id($url){}
function youtube_info($id, $part='snippet')
{
global $yt_api;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://www.googleapis.com/youtube/v3/videos?id={$id}&key={$yt_api}&part={$part}");
curl_setopt($curl, CURLOPT_POST, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($curl);
curl_close($curl);
return json_decode($return, true);
}
$tmp_yt = 'http://www.youtube.com/watch?v=yEJ2-VofNCw'; //유튜브 동영상
$return = youtube_info(get_video_id($tmp_yt)); //유튜브 정보
echo "동영상 : ".$tmp_yt."<br>";
echo "제목 : ".$return['items'][0]['snippet']['title']."<br>"; //title
echo "채널명 : ".$return['items'][0]['snippet']['channelTitle']."<br>"; //channelTitle
echo "썸네일 : <img src='".$return['items'][0]['snippet']['thumbnails']['default']['url']."'><br>"; //thumb default
print_r($return);
?>
관련링크
http://untitled.untitle311apyxry1w48.com/lkbmgfh
참고
게시판 목록
팁게시판
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5727 |
잘살아보자
|
10년 전 | 485 | |
| 5726 | 10년 전 | 1065 | ||
| 5725 | 10년 전 | 1244 | ||
| 5724 | 10년 전 | 962 | ||
| 5723 |
잘살아보자
|
10년 전 | 452 | |
| 5722 |
잘살아보자
|
10년 전 | 423 | |
| 5721 |
잘살아보자
|
10년 전 | 409 | |
| 5720 |
잘살아보자
|
10년 전 | 403 | |
| 5719 |
잘살아보자
|
10년 전 | 476 | |
| 5718 |
잘살아보자
|
10년 전 | 592 | |
| 5717 |
잘살아보자
|
10년 전 | 847 | |
| 5716 |
잘살아보자
|
10년 전 | 381 | |
| 5715 |
starbros
|
10년 전 | 793 | |
| 5714 |
잘살아보자
|
10년 전 | 577 | |
| 5713 |
잘살아보자
|
10년 전 | 469 | |
| 5712 |
잘살아보자
|
10년 전 | 434 | |
| 5711 |
잘살아보자
|
10년 전 | 481 | |
| 5710 |
잘살아보자
|
10년 전 | 435 | |
| 5709 |
잘살아보자
|
10년 전 | 454 | |
| 5708 |
잘살아보자
|
10년 전 | 799 | |
| 5707 |
잘살아보자
|
10년 전 | 378 | |
| 5706 |
잘살아보자
|
10년 전 | 488 | |
| 5705 |
잘살아보자
|
10년 전 | 620 | |
| 5704 |
잘살아보자
|
10년 전 | 536 | |
| 5703 |
잘살아보자
|
10년 전 | 522 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기