0
$headers = array(
                    "Content-type: text/xml;charset=\"utf-8\"",
                    "Accept: text/xml",
                    "Cache-Control: no-cache",
                    "Pragma: no-cache",
                    "SOAPAction: http://ctitechnology.com/UpsertEntity",
                    "Content-length: ".strlen($soap_request),
                );


$soap_do = curl_init();
        curl_setopt($soap_do, CURLOPT_URL, "http://66.7.227.4/tio_ws/ScreeningPartnerWS.asmx");
        curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($soap_do, CURLOPT_POST, true);
        curl_setopt($soap_do, CURLOPT_POSTFIELDS, $soap_request); // the SOAP request
        curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($soap_do, CURLOPT_HEADER, true);
        curl_setopt($soap_do, CURLINFO_HEADER_OUT, true);

        $result = curl_exec($soap_do);


    print "Response:\n";
    print($result);
    print "\n";

    if($result === false) {
            $error = 'Curl error: ' . curl_error($soap_do);
            curl_close($soap_do);
            print $error;
    } else {

            $xml = simplexml_load_string($result);
            print_r($xml);
            print "\n";

I am trying to split the header when it comes back in the response (I need to keep the headers, turning CURLOPT_HEADER to false would do it but I need to keep the response's header intact). At the moment, am not able to parse the xml because the header is included. Any wisdom would be greatly appreciated!

1
  • Any reason you're not using SoapClient? Commented Feb 4, 2015 at 0:33

1 Answer 1

1

HTTP/1.1 specifies that any message body should come after “an empty line (i.e., a line with nothing preceding the CRLF) indicating the end of the header fields

Your question has been answered already here.

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.