Answer the question
In order to leave comments, you need to log in
How to fix error when getting data from Youtube api?
Hello, I have this function:
public static function getYoutubeSubscribers($username) {
$username = trim($username);
if (!$username)
return 0;
$link = 'http://gdata.youtube.com/feeds/api/users/' . strtolower($username);
$info = self::curlGetContent($link);
$xmlData = str_replace('yt:', 'yt', $info);
$xml = new SimpleXMLElement($xmlData);
$subs = $xml->ytstatistics['subscriberCount'];
return($subs);
}
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in D:\OpenServer\domains\localhost\buh.tv\templates\it_premiere\icetools\icetool.php:219 Stack trace: #0 D:\OpenServer\domains\localhost\buh.tv\templates\it_premiere\icetools\icetool.php(219): SimpleXMLElement->__construct('No longer avail...') #1 D:\OpenServer\domains\localhost\buh.tv\templates\it_premiere\icetools\layout_vars.php(44): iceTool::getYoutubeSubscribers('icetheme') #2 D:\OpenServer\domains\localhost\buh.tv\templates\it_premiere\index.php(29): require_once('D:\OpenServer\d...') #3 D:\OpenServer\domains\localhost\buh.tv\libraries\joomla\document\html\html.php(531): require('D:\OpenServer\d...') #4 D:\OpenServer\domains\localhost\buh.tv\libraries\joomla\document\html\html.php(591): JDocumentHTML->_loadTemplate('D:\OpenServer\d...', 'index.php') #5 D:\OpenServer\domains\localhost\buh.tv\libraries\joomla\document\html\html.php(414): JDocumentHTML->_fetchTemplate(Array) #6 D:\OpenServer\domains\localhost\buh.tv\includes\application.php(259): JDocumentHTML->parse(Array) #7 D:\OpenServer\domains\localhost\buh.tv\index.php(48): JSite->render() #8 {main} thrown in D:\OpenServer\domains\localhost\buh.tv\templates\it_premiere\icetools\icetool.php on line 219
Answer the question
In order to leave comments, you need to log in
THIS IS AN OLD API, IT DOESN'T WORK NO LONGER.
An example of how to get v3 api.
www.dulsky.eu/v
In the manuals of Google, everything is written.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question