0

I am using curl to execute soap call below is the Response of Soap XMl, How to read the content of dataText attribute data using php.

    <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
     <soapenv:Header/>
      <soapenv:Body>
       <ins:dataTransferResponseType xmlns:ins="insite:soapws:connectorn:v1">
        <ins:data>
         <dataText>
             <![CDATA[Buyer Name,Buyer Code,Supplier Name,Supplier Code,Account Name,Account 
           Code,Remit To Address Code,Work Order ID,Worker ID,Job Seeker ID,Worker Last Name,Worker 
           First Name,Site Code,Site Name,Business Unit Code,Business Unit Name,Time Sheet ID,Time 
           Sheet Status,Time Sheet Start Date,Time Sheet End Date,Time Sheet Submit Date/Time,Time 
           Sheet Approved Date,Time Entry Date,Cost Center Code,Cost Center Name,Task Code,Task 
          Name,General Ledger Account Code,Billable Per Diem,Billable Hours,Non-billable Hours,Total 
          Hours,Currency,Rate Category / UOM,Bill Rate Supplier,Pay Rate 
           AT&T,ABC,DFG,CNV1,AT&T,ABC,,CDGD2323,ASG6546,cdfgdf534,SEDSS,HGDTTD,30319 - ATLANTA,USA | 
          GA | ATLANTA,12121212,DIGITAL,ssss54343,Invoiced,12/22/2019,12/28/2019,12/23/2019 
          15:51,12/24/2019 15:37,12/23/2019,DL01,Distribution Line 01,Hours Worked,Hours 
            Worked,Default,0.00,8.00,0.00,8.00,USD,ST/Hr,79.41,77.51]]>
         </dataText>
       </ins:data>
     </ins:dataTransferResponseType>
    </soapenv:Body>
    </soapenv:Envelope>

Thanks in advance.

1
  • Here is an extension for that ext/soap Commented Dec 26, 2019 at 15:02

1 Answer 1

1
$xml = '<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
     <soapenv:Header/>
      <soapenv:Body>
       <ins:dataTransferResponseType xmlns:ins="insite:soapws:connectorn:v1">
        <ins:data>
         <dataText>
             <![CDATA[Buyer Name,Buyer Code,Supplier Name,Supplier Code,Account Name,Account 
           Code,Remit To Address Code,Work Order ID,Worker ID,Job Seeker ID,Worker Last Name,Worker 
           First Name,Site Code,Site Name,Business Unit Code,Business Unit Name,Time Sheet ID,Time 
           Sheet Status,Time Sheet Start Date,Time Sheet End Date,Time Sheet Submit Date/Time,Time 
           Sheet Approved Date,Time Entry Date,Cost Center Code,Cost Center Name,Task Code,Task 
          Name,General Ledger Account Code,Billable Per Diem,Billable Hours,Non-billable Hours,Total 
          Hours,Currency,Rate Category / UOM,Bill Rate Supplier,Pay Rate 
           AT&T,ABC,DFG,CNV1,AT&T,ABC,,CDGD2323,ASG6546,cdfgdf534,SEDSS,HGDTTD,30319 - ATLANTA,USA | 
          GA | ATLANTA,12121212,DIGITAL,ssss54343,Invoiced,12/22/2019,12/28/2019,12/23/2019 
          15:51,12/24/2019 15:37,12/23/2019,DL01,Distribution Line 01,Hours Worked,Hours 
            Worked,Default,0.00,8.00,0.00,8.00,USD,ST/Hr,79.41,77.51]]>
         </dataText>
       </ins:data>
     </ins:dataTransferResponseType>
    </soapenv:Body>
    </soapenv:Envelope>';

$dom = new DOMDocument(); 
$dom->loadXML($xml);

if($dom->getElementsByTagName('dataText')->length)
{
     print_r($dom->getElementsByTagName('dataText')->item(0)->nodeValue);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.