I want to fetch the youtube suscriber count in PHP. I tried using
function get_yt_subs($username) {
$xmlData = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . strtolower($username));
$xmlData = str_replace('yt:', 'yt', $xmlData);
$xml = new SimpleXMLElement($xmlData);
$subs = $xml->ytstatistics['subscriberCount'];
return($subs);
}
and
$youtube_url = file_get_contents( 'http://gdata.youtube.com/feeds/api/users/googlechrome';
$youtube_url = str_replace( 'yt:', 'yt', $youtube_url );
$youtube_data = $youtube_url->ytstatistics['subscriberCount'];
both these methods, but it does not work. It's showing error file_get_contents(http://gdata.youtube.com/feeds/api/users/googlechrome): failed to open stream: HTTP request failed! HTTP/1.0 410 Gone