YouTube API如何解决错误的请求错误400 PHP

时间:2015-08-27 02:09:32

标签: php youtube google-api youtube-api

使用此代码时,我的get请求出现400错误请求错误。为什么GET请求失败?

require_once 'inc/ggl/autoload.php';
require_once 'inc/ggl/src/Google/Service/YouTube.php';
require_once 'inc/ggl/src/Google/Client.php';
$client = new Google_Client();
$client->setApplicationName("API_Project");
$client->setDeveloperKey('{MY API KEY}');
$youtube = new Google_Service_YouTube($client);

$videoResponse = $youtube->videos->listVideos('snippet', array(
    'id' => '{ANY VIDEO ID}'
));

$vidtitle = $videoResponse['items'][0]['snippet']['title'];
echo $vidtitle;

1 个答案:

答案 0 :(得分:0)

我明白了。花括号不应该被包括在内......