Jump to content

String could not be parsed as XML


Recommended Posts

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:86

Stack 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!




Edited by grsims20
Link to comment
Share on other sites

$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
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.