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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:42:24+00:00 2026-05-15T04:42:24+00:00

I am making get request in PHP but the parser is having issues. I

  • 0

I am making get request in PHP but the parser is having issues. I am looking for a way to retreive the value of URL in the following example. The response xml looks like this.

<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<testtemplate JobName="test1">
<Sources>
 <Source xmlns="http://www.microsoft.com/test/schema/api">
    <System>
      <SystemIdentifier>HTTPS</SystemIdentifier>
      <URL>http://example.com</URL>
    </System>
 </Source>
</Sources>
<testtemplate>

and my PHP code looks like this:

$xml = DOMDocument::LoadXML($response);
$mypath = new DOMXPath($xml);
$mypath->registerNamespace("a", "http://www.microsoft.com/test/schema/api");

$url = $mypath->evaluate("/testtemplate/Sources/Source/System/URL");
$message = $url->item(0)->value;

print($message);

Any help would be appreciated.

Thanks
Ashish

  • 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-15T04:42:25+00:00Added an answer on May 15, 2026 at 4:42 am

    Your sample XML is malformed (the testtemplate is not closed), assuming that is just a typo lets get on to fixing your main issue.

    You’ll need to use that namespace which was registered in order to access the elements within it, and the DOMElement from item(0) does not have a value property (nodeValue is used instead).

    $xml = DOMDocument::LoadXML($response);
    $mypath = new DOMXPath($xml);
    $mypath->registerNamespace("a", "http://www.microsoft.com/test/schema/api");
    
    // These two lines have changed, slightly.
    $url = $mypath->evaluate("/testtemplate/Sources/a:Source/a:System/a:URL");
    $message = $url->item(0)->nodeValue;
    
    print($message);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 508k
  • Answers 508k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer lw_image() helper adds required javascript and css assets to the… May 16, 2026 at 4:24 pm
  • Editorial Team
    Editorial Team added an answer How do I start to do things? You find an… May 16, 2026 at 4:24 pm
  • Editorial Team
    Editorial Team added an answer You're correct regarding the $0.12 / hour: you're billed based… May 16, 2026 at 4:24 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have the following code making a GET request on a URL: $('#searchButton').click(function() {
I am making a PHP tool that connects to a repository, downloads the list
I make an AJAX POST request to a PHP script on my server. That
I am making a request and then right after it I abort. var x
I have a xml file on my server. I have the following two questions.
I'm using jQuery to setup an Ajax request that grabs an XML feed from
I have a primarily Ajax-driven site, the content of which is populated by making
I make an AJAX request to see if a sesion variable has been set.
How can I send a header to a website as if PHP / Apache
This is a bit of a silly question but I don't know how to

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.