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

  • SEARCH
  • Home
  • 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 8777639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:19:23+00:00 2026-06-13T19:19:23+00:00

simply i use simplexml_load_file to parse xml file when i used it to parse

  • 0

simply i use

simplexml_load_file

to parse xml file

when i used it to parse the file it works just great and return all of the file content

<?php
//$homepage = file_get_contents('');
$x = simplexml_load_file('http://www.metacafe.com/api/videos?vq=sexy&max-results=50');
echo "<pre>";
print_r($x);
echo "</pre>";

?>

the out put just fine

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [version] => 2.0
            [source] => Metacafe
        )

    [title] => Metacafe
    [channel] => SimpleXMLElement Object
        (
            [title] => SimpleXMLElement Object
                (
                )

            [link] => http://www.metacafe.com/tags/sexy/
            [image] => SimpleXMLElement Object
                (
                    [url] => http://s.mcstatic.com/Images/MCLogo4RSS.jpg
                    [link] => http://www.metacafe.com
                    [title] => Metacafe
                    [height] => 65
                    [width] => 229
                )

            [description] => SimpleXMLElement Object
                (
                )

            [item] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [id] => 9310776
                            [author] => ORLIK MUSCLE VIDEO
                            [title] => Muscle Worship. MEET: 18 Y.o. Vlad
                            [link] => http://www.metacafe.com/watch/9310776/muscle_worship_meet_18_y_o_vlad/
                            [rank] => 4.33
                            [category] => Sports
                            [description] => SimpleXMLElement Object
                                (
                                )

                            [guid] => http://www.metacafe.com/watch/9310776/muscle_worship_meet_18_y_o_vlad/
                            [pubDate] => 01-Nov-12 +0000
                        )

                    [1] => SimpleXMLElement Object
                        (
                            [id] => yt-RU2yJxjxMtw
                            [author] => Metacafe Affiliate U
                            [title] => 10 Minute Intense Sexy Bikini ABS WORKOUT!! TRY IT!!
                            [link] => http://www.metacafe.com/watch/yt-RU2yJxjxMtw/10_minute_intense_sexy_bikini_abs_workout_try_it/
                            [rank] => 4.33
                            [category] => How To
                            [description] => SimpleXMLElement Object
                                (
                                )

                            [guid] => http://www.metacafe.com/watch/yt-RU2yJxjxMtw/10_minute_intense_sexy_bikini_abs_workout_try_it/
                            [pubDate] => 30-Oct-12 +0000
                        )

                    [2] => SimpleXMLElement Object
                        (
                            [id] => 9296344
                            [author] => Sonia Wari
                            [title] => Arab Real Hot Girl Desi Video
                            [link] => http://www.metacafe.com/watch/9296344/arab_real_hot_girl_desi_video/
                            [rank] => 4.33
                            [category] => Entertainment
                            [description] => SimpleXMLElement Object
                                (
                                )

                            [guid] => http://www.metacafe.com/watch/9296344/arab_real_hot_girl_desi_video/
                            [pubDate] => 28-Oct-12 +0000
                        )

                    [3] => SimpleXMLElement Object
                        (
                            [id] => 9299266
                            [author] => lehren.tv
                            [title] => Sherlyn Chopra In 3D Kamasutra
                            [link] => http://www.metacafe.com/watch/9299266/sherlyn_chopra_in_3d_kamasutra/
                            [rank] => 4.22
                            [category] => Entertainment
                            [description] => SimpleXMLElement Object
                                (
                                )

                            [guid] => http://www.metacafe.com/watch/9299266/sherlyn_chopra_in_3d_kamasutra/
                            [pubDate] => 29-Oct-12 +0000
                        )

                    [4] => SimpleXMLElement Object
                        (
                            [id] => cb-r3B4NEf5A8sw
                            [author] => CBS
                            [title] => Can the New Dart Give Dodge a Sexy Italian Accent? CNET On Cars, Episode 5
                            [link] => http://www.metacafe.com/watch/cb-r3B4NEf5A8sw/can_the_new_dart_give_dodge_a_sexy_italian_accent_cnet_on_cars_episode_5/
                            [rank] => 4.00
                            [category] => Entertainment
                            [description] => SimpleXMLElement Object
                                (
                                )

                            [guid] => http://www.metacafe.com/watch/cb-r3B4NEf5A8sw/can_the_new_dart_give_dodge_a_sexy_italian_accent_cnet_on_cars_episode_5/
                            [pubDate] => 30-Oct-12 +0000
                        )

                    [5] => SimpleXMLElement Object
                        (
                            [id] => cb-jZx26n5Iweg1
                            [author] => CBS
                            [title] => The Young and the Restless - 10/30/2012 Sneak Peek - Season 40
                            [link] => http://www.metacafe.com/watch/cb-jZx26n5Iweg1/the_young_and_the_restless_10_30_2012_sneak_peek_season_40/
                            [rank] => 4.00
                            [category] => Entertainment
                            [description] => SimpleXMLElement Object
                                (
                                )

                            [guid] => http://www.metacafe.com/watch/cb-jZx26n5Iweg1/the_young_and_the_restless_10_30_2012_sneak_peek_season_40/
                            [pubDate] => 30-Oct-12 +0000
                        )


                )

        )

)

problem is just start when i tried to print the item array only

<?php
//$homepage = file_get_contents('');
$x = simplexml_load_file('http://www.metacafe.com/api/videos?vq=sexy&max-results=50');
echo "<pre>";
print_r($x->channel->item);
echo "</pre>";

?>

this one only getting the first object of the item array not the whole array

SimpleXMLElement Object
(
    [id] => 9310776
    [author] => ORLIK MUSCLE VIDEO
    [title] => Muscle Worship. MEET: 18 Y.o. Vlad
    [link] => http://www.metacafe.com/watch/9310776/muscle_worship_meet_18_y_o_vlad/
    [rank] => 4.33
    [category] => Sports
    [description] => SimpleXMLElement Object
        (
        )

    [guid] => http://www.metacafe.com/watch/9310776/muscle_worship_meet_18_y_o_vlad/
    [pubDate] => 01-Nov-12 +0000
)

what i need to do is to retrieve the whole objects of the item array

  • 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-13T19:19:24+00:00Added an answer on June 13, 2026 at 7:19 pm
    <?php
    //$homepage = file_get_contents('');
    $x = simplexml_load_file('http://www.metacafe.com/api/videos?vq=sexy&max-results=50');
    echo "<pre>";
    foreach($x->channel->item as $key=>$value){
        print_r($value);
    }
    echo "</pre>";
    ?>
    

    Just make it in foraech loop ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use php simple xml parse some tree like this. how to plus
I just found myself a little bit surprised being unable to simply use a
I'm working on a project (simple XML CMS) just to learn some basic PHP.
I'm trying to use Simple XML to interpret a XML file. Teorically i must
I use PHP and Simple XML. I use a loop that does not work
I am parsing a simple XML file, which one i can use for efficient
I use SimpleXML to save a simple POJO into XML file and then read
I'm using simpleXML to parse this xml file . It's a feed I'm using
I have a basic XML file that I load in my PHP using $xml
I am querying an xml file with php like this : public function trackOrderAction()

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.