I’m Making A Small Youtube Channel Info Finder And I’m Wondering How Do I Add A Variable In ‘’ ??
Heres My Code:
[php]
<?php $Channel = 'HonestGamersHD'; $data = file_get_contents('http://gdata.youtube.com/feeds/api/users/' + '$Channel');$xml = new SimpleXMLElement($data);
$stats_data = (array)$xml->children(‘yt’, true)->statistics->attributes();
$stats_data = $stats_data[’@attributes’];
/********* OR **********/
$data = file_get_contents(‘http://gdata.youtube.com/feeds/api/users/’ + ‘$Channel’ + ‘?alt=json’);
$data = json_decode($data, true);
$stats_data = $data[‘entry’][‘yt$statistics’];
/**********************************************************/
echo ‘Subscribers: ‘.$stats_data[‘subscriberCount’].’
’;
echo ‘Video Watch Count: ‘.$stats_data[‘videoWatchCount’].’
’;
echo ‘View Count: ‘.$stats_data[‘viewCount’].’
’;
echo ‘Total Upload Views: ‘.$stats_data[‘totalUploadViews’].’
’;
?>