Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8901409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:20:51+00:00 2026-06-15T01:20:51+00:00

When i launch the php script, sometime works fine, but many other times it

  • 0

When i launch the php script, sometime works fine, but many other times it retrieve me this errror

Fatal error: Call to a member function children() on a non-object in
/membri/americanhorizon/ytvideo/rilevametadatadaurlyoutube.php on line
21

This is the first part of the code

// set feed URL
$feedURL = 'http://gdata.youtube.com/feeds/api/videos/dZec2Lbr_r8';

// read feed into SimpleXML object
$entry = simplexml_load_file($feedURL);

$video = parseVideoEntry($entry);


function parseVideoEntry($entry) {      
  $obj= new stdClass;

  // get nodes in media: namespace for media information
  $media = $entry->children('http://search.yahoo.com/mrss/'); //<----this is the doomed line 21 

UPDATE: solution adopted

   for ($i=0 ; $i< count($fileArray); $i++)
  {

    // set feed URL
    $feedURL = 'http://gdata.youtube.com/feeds/api/videos/'.$fileArray[$i];


    // read feed into SimpleXML object
    $entry = simplexml_load_file($feedURL);


   if (is_object($entry))
   {
       $video = parseVideoEntry($entry);

       echo ($video->description."|".$video->length);
       echo "<br>";
    }
     else
     {
       $i--;
     }

 }

In this mode i force the script to re-check the file that caused the error

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:20:52+00:00Added an answer on June 15, 2026 at 1:20 am

    Sometimes? Really?
    Take a look at this:

    <?php
    
    $dummy; //IN FACT, this var is NULL now
    
    // Will throw exactly the same error you get
    $dummy->children();
    

    Why? Because, we can call method from an object type.

    So, if you wanna avoid errors like this one, next time you would call the method ensure that it’s “possible”.

    <?php
    
    if ( is_object($dummy) && method_exists($dummy, 'children') ){
       //sure it works
       $dummy->children();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when I try to launch my PHP script, I get this error: [error] [client
I'm trying to launch a CLI command from a PHP script: in particular I
I am writing a PHP script that will launch a program on the server.
I want to launch ~10 php processes from a bash script. When one of
When I have this PHP script. <?php exec('/usr/local/bin/mate hello.txt'); ?> It doesn't work on
This will be a newbie question but I'm learning php for one sole purpose
I want to launch a python script similar to this web crawler , wait
I fund and inserted this code in my FTP in a backup.php that works
If I launch a PHP daemon in Windows with popen from a PHP script
I want launch simple php daemon on Ubuntu without fork. source f.php: #!/usr/bin/php <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.