This php code:
<?php
$video_id = 'k3VevYjjwQk';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://gdata.youtube.com/feeds/api/videos/'.$video_id);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
if ($response) {
$xml = new SimpleXMLElement($response);
$title = (string) $xml->statistics->attributes()->viewCount;
echo $title;
} else {
// Error handling.
}
?>
returns:
Warning: main(): Node no longer exists in C:\xampp\htdocs\work.php on line 13
Warning: main(): Node no longer exists in C:\xampp\htdocs\work.php on line 13