cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Curl XML and PHP

From: Davor _at_ Velcom <_at_>
Date: Wed, 16 Mar 2005 12:27:23 -0500

Leonardo Santillán wrote:

> Hi,
>
> Im trying to post a XML string to a secure server and get the XML
> response from it in a PHP variable but i cant make it.
> I'll appreciate any help.
> Thanks,
>
> Im using this code:
>
> $url = "https//www.server.com";
> $xmlcontent = "<?xml version=\"1.0\" ?>";
> $xmlcontent .= "<blah prod=\"ggg\">";
> $xmlcontent .= "<session><aaa><id>123</id>";
> $xmlcontent .= "<user><firstName>me</firstName></user></aaa>";
> $xmlcontent .= "</session>";
> $xmlcontent .= "</blah>";
> $data = "id=888$request=$xmlcontent";
>
> $result = shell_exec("curl -m 120 -d \"$data\" $url -L");
> echo $result;
>
> and/or
>
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL,$url);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);

> curl_setopt($ch, CURLOPT_TIMEOUT, 4);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
> $result = curl_exec($ch);
> echo $result;
Received on 2005-03-16