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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:09:04+00:00 2026-06-03T15:09:04+00:00

The project that I’m currently working on involves translating a website that was written

  • 0

The project that I’m currently working on involves translating a website that was written in Python to PHP code. The part I’m doing now requires me to send $_GET requests to a web server. The response that I get back is always in XML format, so I’m using the *simplexml_load_file()* function to fetch the result.

I need to parse through the XML that the web server sends back to me. Python had a nice library called BeautifulStoneSoup, which had a find() method that returned the contents of a specified attribute.

After looking at the list of PHP functions at http://php.net/manual/en/book.simplexml.php, I cannot seem to find anything that allows me to specify an attribute name and get the contents. Keep in mind that attribute I may be looking for is not necessarily going to always be one level deep into the XML array. It may be several dimensions into the array.

I can provide an example if this wasn’t specific enough. Thanks for the help, friends!

  • 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-03T15:09:07+00:00Added an answer on June 3, 2026 at 3:09 pm

    Xpath sounds like what your looking for. It allows for searches to be made within any level of an XML directory.

    The following example looks multiple levels deep with an xml directory and checks if the description node contains whatever is held within $txtSearch

    $holidayDoc = simplexml_load_file($url);    
    $qry = "//channel/item[description[contains(text(),\"$txtSearch\")]]";
    $holidayDoc->xpath($qry);
    

    Results can then be iterated through using a foreach loop

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

Sidebar

Related Questions

The project that I've been working on involves porting some old code. Right now
The project that I am currently working on at the moment uses SVN for
The project that I'm currently working on, is large scale. I'm using email activation
I have a project that I'm currently working on but it currently only supports
We have a PHP project that we would like to version control. Right now
For a new project that I'm doing in PHP I've created an SQLMethods class
My project that involves antenna design, in which Python generates the .nec file that
I'm working on project that lets users choose some scientific authors and columnists and
I am doing a project that has dependencies on some classes from the mahout
I'm doing a project that aims to create a PDF using the exiftool library

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.