Отвечаю сам себе:
function send_req($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$out = curl_exec($ch);
curl_close($ch);
return $out;
}
$url = "https://www.googleapis.com/youtube/v3/search?part=snippet&q=$keyword&type=video&maxResults=50&key=$api_token";
$res = json_decode(send_req($url));
echo "<pre>";
print_r($res);
echo "<hr>";
$pagetoken = $res->nextPageToken;
$url = "https://www.googleapis.com/youtube/v3/search?part=snippet&q=$keyword&type=video&maxResults=50&pageToken=$pagetoken&key=$api_token";
$res = json_decode(send_req($url));
print_r($res);