Responsive Ad Area

Share This Post

test

call soap request in PHP by CURL

this is a soap link that i need to call with curl :

http://webservice-ip1.systemnic.net/index.php?wsdl

want to need this function

>message name="domainInfoRequest

and it’s answer

>message name="domainInfoResponse

but i don’t know how call it , i saw other topics but they wasn’t helpfull, i wrote this code:

    $soapUrl = "http://webservice-ip1.systemnic.net/index.php?wsdl"; // asmx URL of WSDL
    $soapUser = "username";  //  username
    $soapPassword = "password"; // password

    // xml post structure

    $xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
                        <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                          <soap:Body>
                            <domainInfo xmlns="http://webservice-ip1.systemnic.net/index.php?wsdl">
                              <api_user>"myusername"</api_user> 
                              <api_pass>"mypass"</api_pass> 
                              <domain>"mydomain"</domain> 
                            </domainInfo >
                          </soap:Body>
                        </soap:Envelope>';   // data from the form, e.g. some ID number

       $headers = array(
                    "Content-type: text/xml;charset="utf-8"",
                    "Accept: text/xml",
                    "Cache-Control: no-cache",
                    "Pragma: no-cache",
                    "SOAPAction: http://webservice-ip1.systemnic.net/index.php?wsdl", 
                    "Content-length: ".strlen($xml_post_string),
                ); //SOAPAction: your op URL

        $url = $soapUrl;

        // PHP cURL  for https connection with auth
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
        curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_VERBOSE, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);

        curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

        // converting
        $response = curl_exec($ch); 
        curl_close($ch);

        // converting
        $response1 = str_replace("<soap:Body>","",$response);
        $response2 = str_replace("</soap:Body>","",$response1);

        // convertingc to XML
        $parser = simplexml_load_string($response2);
        // user $parser to get your data out of XML response and to display it.

but i didn’t work !


call soap request in PHP by CURL
call soap request in PHP by CURL
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar