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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:37:05+00:00 2026-06-15T04:37:05+00:00

How to get values from below result using PHP. <?xml version=1.0 encoding=UTF-8?> <soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/

  • 0

How to get values from below result using PHP.

<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Header/>
      <soapenv:Body>
        <p558:registerDonorResponse xmlns:p558="http://ws.ots.labcorp.com">
          <p558:registerDonorReturn xmlns:p118="http://data.ws.ots.labcorp.com">
            <p118:clientRegistrationId>clr1</p118:clientRegistrationId>
            <p118:labcorpRegistrationNumber>100059064</p118:labcorpRegistrationNumber>
            <p118:registrationTime>2012-12-01T05:40:51.628Z</p118:registrationTime>
          </p558:registerDonorReturn>
        </p558:registerDonorResponse>
      </soapenv:Body>
    </soapenv:Envelope>

Thanks.

  • 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-15T04:37:07+00:00Added an answer on June 15, 2026 at 4:37 am

    Your XML contains namespace-prefixed tags as it’s common for SOAP responses.

    Have a look at following comment from php’s SimpleXML docs:

    $xml = <<<XML
    <?xml version="1.0" encoding="UTF-8"?>
    <people xmlns:p="http://example.org/ns" xmlns:t="http://example.org/test">
        <p:person id="1">John Doe</p:person>
        <p:person id="2">Susie Q. Public</p:person>
    </people>
    XML;
    
    $sxe = new SimpleXMLElement($xml);
    
    $ns = $sxe->getNamespaces(true);
    
    $child = $sxe->children($ns['p']);
    
    foreach ($child->person as $out_ns)
    {
        echo $out_ns;
    }
    

    In your case code accessing the properties should look like that (it’s tested against your XML in so.xml file):

    <?php
      $xml = file_get_contents('so.xml');
      $sxe = simplexml_load_string($xml);
    
      $ns = $sxe->getNamespaces(true);
    
      $child =
        $sxe->children($ns['soapenv'])->
          Body->children($ns['p558'])->
          registerDonorResponse->registerDonorReturn->children($ns['p118']);
    
      var_dump($child);
    

    Result:

    $ php -f so.php 
    object(SimpleXMLElement)#4 (3) {
      ["clientRegistrationId"]=>
      string(4) "clr1"
      ["labcorpRegistrationNumber"]=>
      string(9) "100059064"
      ["registrationTime"]=>
      string(24) "2012-12-01T05:40:51.628Z"
    }
    

    Please note however that issuing SOAP requests and parsing responses by hand is generally a bad practice, consider using SOAP client for that.

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

Sidebar

Related Questions

I am trying to get double values from file using fscanf function. I am
Would like to get the following as a result from the table structure below
I am trying to get result using below query, idRegion is recorded in database
i want to get result where a column values are NULL using LINQ Expressions
I am wondering how to get the Json value ?(from below JSOn I would
I'm trying to get values from nsdata class and doesn't work. here is my
I want to get values from a row with the largest certain value (in
I am trying to get values from a data set. My function has to
Can someone please let me know how to get values from several input fields?
I am trying to get the values from an HTML table row. When I

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.