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
Member Avatar for LastMitch

@AndyPants

Whats wrong with this? XML

What are you trying to do?

What is statistics?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.