php - Using SimpleXMLElement in an array -


so testing feed on page pulls wordpress site , worked locally reason on production server needs array. $xml variable used in foreach works locally not on server because it's not array. first time using simplexmlelement i'm not sure if using methods looked in manual turn $xml array via function json work have here. there away convert $xml array , use array results in foreach()?

<?php $xml = simplexml_load_string($data, 'simplexmlelement', libxml_nocdata); ?>  <?php  $i = 0; foreach ($xml->channel->item $item) { $creator = $item->children('dc', true); echo '<h2>' . $item->title . '</h2>'; echo '<small>posted on '. date('l f d, y', strtotime($item->pubdate)) .' '.$creator.'</small> </p>'; echo '<p class="description">' . $item->description . '</p>'; if (++$i === 3) break; } ?> 


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -