【自分用メモ】PHPでYouTube APIを利用する方法
○PEAR Cache_Liteをインストール
DOSコマンドで、
cd c:\php
pear install Cache_Lite
C:\php\PEAR\Cacheというフォルダができている。
○curlを使えるようにする。
php.iniで下記の「;」を外す。
extension=php_curl.dll
○phpのフォルダ内にあるlibeay32.dll および ssleay32.dllを、C:\WINDOWS\system32 へコピーする。
C:\php\PEAR\XML\RPC2というフォルダができている。
○PEAR Services_YouTube-0.2.1をインストール
C:\php>pear install Services_YouTube-0.2.1
C:\php\PEAR\Servicesというフォルダができている。
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
require_once('Services/YouTube.php');
$dev_id = "俺のID";
$youtube = new Services_YouTube($dev_id, array('usesCache' => true));
$videos = $youtube->listFeatured();
foreach ($videos->xpath('//video') as $i => $video) {
print_r($video);
}