u

유튜브 api 사용하기

· 10년 전 · 4055
스크린샷 2015-05-06 오후 11.18.28.png

데모

 

<?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

 

 

 

 

참고

http://youtu.be/rV4sAX_WVvA 

|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

태그 필터 (최대 3개) 전체 개발자 소스 기타 mysql 팁자료실 javascript php linux flash 정규표현식 jquery node.js mobile 웹서버 os 프로그램 강좌 썸네일 이미지관련 도로명주소 그누보드5 기획자 견적서 계약서 기획서 마케팅 제안서 seo 통계 서식 통계자료 퍼블리셔 html css 반응형 웹접근성 퍼블리싱 표준화 반응형웹 홈페이지기초 부트스트랩 angularjs 포럼 스크린리더 센스리더 개발자톡 개발자팁 퍼블리셔톡 퍼블리셔팁 기획자톡 기획자팁 프로그램강좌 퍼블리싱강좌
+
제목 글쓴이 날짜 조회
10년 전 조회 1,804
10년 전 조회 2,180
10년 전 조회 2,465
10년 전 조회 2,873
10년 전 조회 4,215
10년 전 조회 2,996
10년 전 조회 3,146
10년 전 조회 3,632
10년 전 조회 5,271
10년 전 조회 2,836
10년 전 조회 1,999
10년 전 조회 3,725
10년 전 조회 2,161
10년 전 조회 2,409
10년 전 조회 3,171
10년 전 조회 2,042
10년 전 조회 2,055
10년 전 조회 4,354
10년 전 조회 2,096
10년 전 조회 1,965
10년 전 조회 1,990
10년 전 조회 1,883
10년 전 조회 2,403
10년 전 조회 2,107
10년 전 조회 1,993
10년 전 조회 2,131
10년 전 조회 2,659
10년 전 조회 3,486
10년 전 조회 2,539
10년 전 조회 2,810
10년 전 조회 3,325
10년 전 조회 2,710
10년 전 조회 2,486
10년 전 조회 2,433
10년 전 조회 5,319
10년 전 조회 2,124
10년 전 조회 2,435
10년 전 조회 2,964
10년 전 조회 2,433
10년 전 조회 4,121
10년 전 조회 2,350
10년 전 조회 2,291
10년 전 조회 2,405
10년 전 조회 5,962
10년 전 조회 2,268
10년 전 조회 3,822
10년 전 조회 3,124
10년 전 조회 3,752
10년 전 조회 3,387
10년 전 조회 4,056
10년 전 조회 2,236
10년 전 조회 2,514
10년 전 조회 4,330
10년 전 조회 2,691
10년 전 조회 2,083
10년 전 조회 3,069
10년 전 조회 2,812
10년 전 조회 2,538
10년 전 조회 2,518
10년 전 조회 2,725
10년 전 조회 2,377
10년 전 조회 1,969
10년 전 조회 2,717
10년 전 조회 3,162
10년 전 조회 2,732
10년 전 조회 2,767
10년 전 조회 3,424
10년 전 조회 4,461
10년 전 조회 2,147
10년 전 조회 2,144
10년 전 조회 2,611
10년 전 조회 2,852
10년 전 조회 2,378
10년 전 조회 2,048
10년 전 조회 2,213
11년 전 조회 2,327
11년 전 조회 2,552
11년 전 조회 2,691
11년 전 조회 3,398
11년 전 조회 2,019
11년 전 조회 2,242
11년 전 조회 6,308
11년 전 조회 2,116
11년 전 조회 2,592
11년 전 조회 2,526
11년 전 조회 3,006
11년 전 조회 2,446
11년 전 조회 2,714
11년 전 조회 2,753
11년 전 조회 3,160
11년 전 조회 2,921
11년 전 조회 3,777
11년 전 조회 3,180
11년 전 조회 3,264
11년 전 조회 2,373
11년 전 조회 2,638
11년 전 조회 2,587
11년 전 조회 2,271
11년 전 조회 2,081
11년 전 조회 2,255