Having problem sending XML over HTTP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

 

I picked up an example from Curl section on php.net. I am able to access the
remote page fine with a custom header. Unfortunately, I am not able to
retrieve the XML I am sending at the remote end. I have tried both
$HTTP_RAW_POST_DATA and php://input but neither of them returns anything. I
am putting my code below just in case anyone can point out the problem in
there.

 

$xmlstr = <<<XML

<query>

            <username>fff-bbbb</username>

            <password>alphanumeric</password>

            <function>GetPackageVersion</function>

</query>

XML;

 

$header[] = "MIME-Version: 1.0 \r\n";

$header[] = "Content-type: multipart/mixed; boundary=----doc \r\n";

//$header[] = "Accept: text/xml \r\n";

$header[] = "Content-length: ".strlen($xmlstr)." \r\n";

$header[] = "Cache-Control: no-cache";

$header[] = "Connection: close \r\n\r\n";

$header[] = $xmlstr;

 

print("setting url<BR>");

$request = curl_init("http://mrcod.concisehosting.com/index.php";);

print("setting options<BR>");

curl_setopt($request, CURLOPT_RETURNTRANSFER, true);

curl_setopt($request, CURLOPT_TIMEOUT, 4);

curl_setopt($request, CURLOPT_HTTPHEADER, $header);

curl_setopt($request, CURLOPT_CUSTOMREQUEST, 'POST');

 

print("connecting...<BR>");

$response = curl_exec($request);

//curl_exec($request);

curl_close($request);

print($response);

 

I have checked the ini file. Memory reserved for POST is 8M. Moreover, I
even tried turning 'always_populate_http_raw_post_data' but it doesn't work.
Any one any ideas, I am in real need for help on this.

 

Regards

Nauman Akbar

Concise Solutions


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux