Posting XML using https in php

Dear Gurus,

I have a code to post XML data via HTTPS site but it is failing. The response i am getting is that i am send nothing. here below is the code:

       $url = "https://localhost/receivee.php?auth=124455rjfjfj";
        $post_data = array("XML" => $postfields);
        $xml = http_build_query($post_data);
        $stream_options = array(
            "ssl" => array(
                "verify_peer" => false,
                "verify_peer_name" => false),
            $url => array(
                "method" => "POST",
                'header' => "Content-type: application/x-www-form-urlencoded\r\n" .
                "Content-length: " . strlen($xml),
                "content" => $xml,
        $context = stream_context_create($stream_options);
        $response = file_get_contents($url, 0, $context);

        return $response;

What is in $postfields? I can’t see where you take that data and convert it into XML format, is it already build that way?

the stream option key should be https, not the full URL.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.