PHP Helper

PHP Library

  • How to use Soap Service in PHP with curl

    Posted in PHP on May 23, 2020

    Initialize variables

    $soapUrl =

    $soapUser = if required

    $soapPassword = if requiref

    Create Request string

    $xml_post_string = '
    <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:rfc:functions"> 
    <soapenv:header> 
    <soapenv:body> 
    <root> 
    <child> 
    <empid>7</empid> 
    </child> 
    </root> 
    </soapenv:body> 
    </soapenv:header>
    </soapenv:envelope>'; 

    Set Http Header for Curl

    $headers = array( 
    "Content-type: text/xml;charset=\"utf-8\"", 
    "Accept: text/xml", 
    "Cache-Control: no-cache", 
    "Pragma: no-cache", 
    "Content-length: ".strlen($xml...