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

curl-and-php

Curl XML and PHP

From: Leonardo Santillán <leo_at_azultel.net>
Date: Wed, 16 Mar 2005 14:12:09 -0300

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_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
echo $result;
Received on 2005-03-16