grsims20 Posted March 6, 2013 Share Posted March 6, 2013 Hi Gang, New forum user here... I'm using a wordpress build which has broken and I'm getting an error log of "String could not be parsed as XML" on the twitter.php doc that comes with the theme. Here is the error log: [23-Feb-2013 23:32:37] PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home2/gregosg8/public_html/wp-content/themes/iodineering/includes/class-twitter.php:86Stack trace: #0 /home2/gregosg8/public_html/wp-content/themes/iodineering/includes/class-twitter.php(86): SimpleXMLElement->__construct('') #1 /home2/gregosg8/public_html/wp-content/themes/iodineering/includes/defaults.php(67): Padd_Twitter->__construct('grsims20', 3, true) #2 /home2/gregosg8/public_html/wp-content/themes/iodineering/functions.php(30): require('/home2/gregosg8...') #3 /home2/gregosg8/public_html/wp-settings.php(287): include('/home2/gregosg8...') #4 /home2/gregosg8/public_html/wp-config.php(90): require_once('/home2/gregosg8...') #5 /home2/gregosg8/public_html/wp-load.php(29): require_once('/home2/gregosg8...') #6 /home2/gregosg8/public_html/wp-blog-header.php(12): require_once('/home2/gregosg8...') #7 /home2/gregosg8/public_html/index.php(17): require('/home2/gregosg8...') #8 {main} thrown in /home2/gregosg8/public_html/wp-content/themes/iodineering/includes/class-twitter.php on line 86 And here is the code section in question: $xml = new SimpleXMLElement($data); $this->followers_count = intval($xml->followers_count); $this->friends_count = intval($xml->friends_count); $this->listed_count = intval($xml->listed_count); $this->statuses_count = intval($xml->statuses_count); $this->profile_image_url = $xml->profile_image_url; The "$xml = new SimpleXMLElement($data);" line is line 86 referenced in the error log. I don't care about having twitter embedded on my site, so disabling anything is fine, but I need help! Thanks! Greg Link to comment https://forums.phpfreaks.com/topic/275314-string-could-not-be-parsed-as-xml/ Share on other sites More sharing options...
devWhiz Posted March 6, 2013 Share Posted March 6, 2013 Try simplexml_load_string() Link to comment https://forums.phpfreaks.com/topic/275314-string-could-not-be-parsed-as-xml/#findComment-1416936 Share on other sites More sharing options...
grsims20 Posted March 6, 2013 Author Share Posted March 6, 2013 Try simplexml_load_string() Sorry to be an amateur, but where do I put that? Link to comment https://forums.phpfreaks.com/topic/275314-string-could-not-be-parsed-as-xml/#findComment-1416939 Share on other sites More sharing options...
devWhiz Posted March 6, 2013 Share Posted March 6, 2013 $xml = simplexml_load_string($data); $this->followers_count = intval($xml->followers_count); $this->friends_count = intval($xml->friends_count); $this->listed_count = intval($xml->listed_count); $this->statuses_count = intval($xml->statuses_count); $this->profile_image_url = $xml->profile_image_url; Link to comment https://forums.phpfreaks.com/topic/275314-string-could-not-be-parsed-as-xml/#findComment-1416941 Share on other sites More sharing options...
devWhiz Posted March 6, 2013 Share Posted March 6, 2013 What are the contents of the $data variable? Link to comment https://forums.phpfreaks.com/topic/275314-string-could-not-be-parsed-as-xml/#findComment-1416949 Share on other sites More sharing options...
grsims20 Posted March 6, 2013 Author Share Posted March 6, 2013 What are the contents of the $data variable? That's just it...I'm not sure. I'm guessing my twitter credentials, but I don't even know where to look for that variable. Is that in the same PHP document? Link to comment https://forums.phpfreaks.com/topic/275314-string-could-not-be-parsed-as-xml/#findComment-1416950 Share on other sites More sharing options...
Barand Posted March 6, 2013 Share Posted March 6, 2013 An easy way to find out is echo $data; Link to comment https://forums.phpfreaks.com/topic/275314-string-could-not-be-parsed-as-xml/#findComment-1417020 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.