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 7178183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:52:11+00:00 2026-05-28T16:52:11+00:00

I’m trying to parse out the XML below with the PHP code shown here

  • 0

I’m trying to parse out the XML below with the PHP code shown here but I end up getting a blank screen when it runs. I’ve been looking around on stackoverflow for similar questions and other similar responses but I still can’t get it to work.

    <?php
    $url = 'xml-file.xml';
    $xml = simplexml_load_file($url);

    // get first book title
    $title=$xml->entry[0]->name;
    // show title
    echo $title;
    echo '<br/>';
    // get second book title
    $title=$xml->entry[1]->name;
    // show title
    echo $title;
    echo '<br/>';
    ?>

Here is the XML:

   <?xml version="1.0" encoding="UTF-8"?>
    <feed gd:kind="shopping#products" gd:etag="&quot;lm_25heFT8yiumci9EH1kItJBpg/bXZf0ylJ3aJceGcE1I8C1fJbzgo&quot;" xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:s="http://www.google.com/shopping/api/schemas/2010">
     <id>tag:google.com,2010:shopping/products</id>
     <updated>2012-01-27T13:41:20.177Z</updated>
     <title>Shopping Products</title>
     <generator version="v1" uri="https://www.googleapis.com/shopping/search/">Search API for Shopping</generator>
     <link rel="alternate" type="text/html" href="https://www.googleapis.com/shopping/search/"/>
     <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://www.googleapis.com/shopping/search/v1/public/products?alt=atom"/>
     <link rel="self" type="application/atom+xml" href="https://www.googleapis.com/shopping/search/v1/public/products?country=US&amp;q=digital+camera&amp;alt=atom&amp;startIndex=1&amp;maxResults=25"/>
     <link rel="next" type="application/atom+xml" href="https://www.googleapis.com/shopping/search/v1/public/products?country=US&amp;q=digital+camera&amp;alt=atom&amp;startIndex=26&amp;maxResults=25"/>
     <link rel="previous" type="application/atom+xml"/>
     <openSearch:totalResults>6446790</openSearch:totalResults>
     <openSearch:startIndex>1</openSearch:startIndex>
     <openSearch:itemsPerPage>25</openSearch:itemsPerPage>


    <entry gd:kind="shopping#product">>
      <id>tag:google.com,2010:shopping/products/2860562/9400569674928563633</id>
      <author>
       <name>Amazon.com</name>
      </author>
      <published>2010-08-19T05:50:21.000Z</published>
      <updated>2012-01-26T23:54:26.000Z</updated>
      <title>Canon powershot s95 10 mp digital camera with 3.8x wide angle optical image         stabilized zoom and 3.0-inch lcd</title>
      <content type="text">desc</content>
      <link rel="alternate" type="text/html" href="https://rads.stackoverflow.com/amzn/click/com/B003ZSHNGS" rel="nofollow noreferrer"/>
      <link rel="self" type="application/atom+xml" href="https://www.googleapis.com/shopping/search/v1/public/products/2860562/gid/9400569674928563633?alt=atom"/>
      <s:product>
       <s:googleId>9400569674928563633</s:googleId>
       <s:author>
        <s:name>Amazon.com</s:name>
        <s:accountId>2860562</s:accountId>
       </s:author>
       <s:creationTime>2010-08-19T05:50:21.000Z</s:creationTime>
       <s:modificationTime>2012-01-26T23:54:26.000Z</s:modificationTime>
       <s:country>US</s:country>
       <s:language>en</s:language>
       <s:title>Canon powershot s95 10 mp digital camera with 3.8x wide angle optical image stabilized zoom and 3.0-inch lcd</s:title>
       <s:description>desc</s:description>
       <s:link>http://www.amazon.com/Canon-PowerShot-S95-Stabilized-3-0-Inch/dp/B003ZSHNGS</s:link>
       <s:brand>Canon</s:brand>
       <s:condition>new</s:condition>
       <s:gtin>00013803126556</s:gtin>
       <s:gtins>
        <s:gtin>00013803126556</s:gtin>
       </s:gtins>
       <s:inventories>
        <s:inventory channel="online" availability="inStock">
         <s:price shipping="0.0" currency="USD">340.41</s:price>
        </s:inventory>
       </s:inventories>
       <s:images>
        <s:image link="http://ecx.images-amazon.com/images/I/519z3AjKzHL._SL500_AA300_.jpg"/>
       </s:images>
      </s:product>
     </entry>

     <entry gd:kind="shopping#product">
       <id>tag:google.com,2010:shopping/products/2860562/12997829348635087420</id>
       <author>
        <name>Amazon.com</name>
       </author>
       <published>2010-09-14T13:18:12.000Z</published>
       <updated>2012-01-26T23:07:30.000Z</updated>
       <title>Canon g12 10 mp digital camera with 5x optical image stabilized zoom and 2.8 inch vari-angle lcd</title>
       <content type="text">desc</content>
       <link rel="alternate" type="text/html" href="https://rads.stackoverflow.com/amzn/click/com/B0041RSPRS" rel="nofollow noreferrer"/>
       <link rel="self" type="application/atom+xml" href="https://www.googleapis.com/shopping/search/v1/public/products/2860562/gid/12997829348635087420?alt=atom"/>
       <s:product>
        <s:googleId>12997829348635087420</s:googleId>
        <s:author>
         <s:name>Amazon.com</s:name>
         <s:accountId>2860562</s:accountId>
        </s:author>
        <s:creationTime>2010-09-14T13:18:12.000Z</s:creationTime>
        <s:modificationTime>2012-01-26T23:07:30.000Z</s:modificationTime>
        <s:country>US</s:country>
        <s:language>en</s:language>
        <s:title>Canon g12 10 mp digital camera with 5x optical image stabilized zoom and 2.8 inch vari-angle lcd</s:title>
        <s:description>desc</s:description>
        <s:link>http://www.amazon.com/Canon-G12-Digital-Stabilized-Vari-         Angle/dp/B0041RSPRS</s:link>
        <s:brand>Canon</s:brand>
        <s:condition>new</s:condition>
        <s:gtin>00013803126815</s:gtin>
        <s:gtins>
         <s:gtin>00013803126815</s:gtin>
        </s:gtins>
        <s:inventories>
         <s:inventory channel="online" availability="inStock">
          <s:price shipping="0.0" currency="USD">395.95</s:price>
         </s:inventory>
        </s:inventories>
        <s:images>
         <s:image link="http://ecx.images-amazon.com/images/I/516mn5voF0L._SL500_AA300_.jpg"/>
        </s:images>
       </s:product>
      </entry>


     </feed>
  • 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-05-28T16:52:12+00:00Added an answer on May 28, 2026 at 4:52 pm

    I don’t see name in the XML at this location

    $title = $xml->entry[1]->name;
    

    I do see name at the author:

    $title = $xml->entry[1]->author->name;
    

    And I do see a title

    $title = $xml->entry[1]->title;
    

    Thats probably what you are looking for. Otherwise, do below, for debugging purposes to see how to access everything.

    echo '<pre>'; 
    print_r($xml->entry[1]);
    echo '</pre>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I would like to count the length of a string with PHP. The string

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.