Re: Sending XML requests as raw post data

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

 



2009/2/7 Marc Steinert <lists@xxxxxxxxxx>

> Hi there!
>
> The software I'm maintaining uses $HTTP_RAW_POST_DATA to receive XML
> requests, posted by some client  written in C#.
> Now I need to write a PHP client that posts XML requests the same way as
> the C# client, so that the posted data is stored in $HTTP_RAW_POST_DATA,
> too.
>
> I tried to use curl to match my needs, but failed to establish a connection
> with the following code:
>
> $header[] = "Host: ".$host;
> $header[] = "MIME-Version: 1.0";
> $header[] = "Accept: text/xml";
> $header[] = "Content-length: ".strlen($xmlRequest);
> $header[] = "Cache-Control: no-cache";
> $header[] = "Connection: close \r\n";
> $header[] = $xmlRequest; // Contains the XML request
>
> curl_setopt($curl, CURLOPT_URL,self::BASE_URL);
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($curl, CURLOPT_TIMEOUT, 4);
> curl_setopt($curl, CURLOPT_CUSTOMREQUEST,'POST');
> curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
>
> // Dispatch request and read answer
> $response = curl_exec($curl); // returns false
>
>
> Thanks for your help.
>
> Greetings from Germany
>
> Marc
>
> --
> http://bithub.net/
> Synchronize and share your files over the web for free
>
>
> My Twitter feed
> http://twitter.com/MarcSteinert
>
> Take a look at the free, open source php JSON-RPC  at *jsonrpcphp*.org ,
in the client you will find a very good example of what you need. (Sorry no
time to provide it directly)

>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Alpar Torok

[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