Curl Response XML

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Oct 13, 2020 10:16 am

Tue Oct 13, 2020 10:19 am

Hello guys,

What I do is consuming SOAP Web Service that returns XML data as follows:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="">false</string>
Unfortunately the curl returns something that I can't parse to XML and get the value "false"

My PHP code is the following:

Code: Select all

   $soap_do = curl_init();
    curl_setopt($soap_do, CURLOPT_URL,            $url );
    curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
    curl_setopt($soap_do, CURLOPT_POST,           true );
    curl_setopt($soap_do, CURLOPT_POSTFIELDS,     $soap_request);
    curl_setopt($soap_do, CURLOPT_HTTPHEADER,     $header);

    curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
    $result = curl_exec($soap_do);
    $xml = simplexml_load_string($result);
    return $xml; 
How do I parse this SOAP response? Thank you very much
Post Reply