Jump to content

Search the Community

Showing results for tags 'node'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 2 results

  1. I am trying to get the names of the children nodes in XML Here is the code: foreach ($pos->children() as $child) { echo "I never get here"; echo $child->getName() . "\n"; } //} echo "but the node has children---<br>"; print_r($pos); which I modeled on the code from http://www.php.net/manual/en/simplexmlelement.getname.php and here is a sample of the output: SimpleXMLElement Object ( [n] => SimpleXMLElement Object ( ) ) but the node has children--- SimpleXMLElement Object ( [int] => SimpleXMLElement Object ( ) ) but the node has children--- SimpleXMLElement Object ( [n] => SimpleXMLElement Object ( ) ) Why can't I go through the chldren with foreach?
  2. I've got some code that displays a feed from a wordpress xml and it does perfectly on my mamp localhost but when I put it on the windows server everthing just falls apart. <?php $curl = curl_init(); curl_setopt_array($curl, Array( CURLOPT_URL => 'http://blog.thisisfusion.com/feed/', CURLOPT_USERAGENT => 'spider', CURLOPT_TIMEOUT => 120, CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_ENCODING => 'UTF-8' )); $data = curl_exec($curl); curl_close($curl); $xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA); ?> And the loop portion here: <?php $i = 0; foreach ($xml->channel->item as $item) { $creator = $item->children('dc', TRUE); echo '<h2>' . $item->title . '</h2>'; echo '<small>Posted on '. date('l F d, Y', strtotime($item->pubDate)) .' by '.$creator.'</small> </p>'; echo '<p class="description">' . $item->description . '</p>'; if (++$i > 2) break; } ?> It's having a fit on the server saying that THIS section foreach ($xml->channel->item as $item) is trying to get the property of a nonobject and that it's an invalid argument in foreach. If this was truly the case, why is it working on my localhost? I've tried a lot of different methods and I have no clue what to do anymore. I var_dumped and didn't see anything maybe something in $xml is null and I missed it? But I checked to make sure that wasn't the case. I don't know. I would appreciate some help. Thank you.
  • 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.