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

curl-and-php

Please Help me! php + curl + xml

From: Renato Bonicio <renatobonicio_at_gmail.com>
Date: Thu, 1 Dec 2005 10:14:24 -0200

Hi people,

I´m Renato from Brazil.
I´m a begginer when we talk about Curl.

I have found some examples on the internet and i had mixed them trying to
solve my problem. but the only thing i receive is a "connection timeout"

The server that im trying to connect is https://pro400.seven.com/api

i want to send a xml file to this server..
i found only codes that create a xml string..but i want to send the file
with the xml, not a simple string
can you help me????

my code: (i think there are to many errors)

<?php

$proxy = 'http://pro400.seven.com/api';
//$proxypwd = base64_encode("dssys:dssys");
//$proxypwd = "dssys,dssys";

$XMLRequest = "<?xml version='1.0' encoding='UTF-8'?";
$XMLRequest .= ">\n";
$XMLRequest .= "<S7Auth.LoginOA>\n";
$XMLRequest .= "<username>paulo-oa</username>\n";
$XMLRequest .= "<password>paulo1972</password>\n";
$XMLRequest .= "</S7Auth.LoginOA>\n";

//$ServiceId = 'urn:com.schober:paymaster.ConsumerAddressCheck_Tst';

$data_string = "XMLRequest=".$XMLRequest;

$curl_handle = curl_init("http://pro400.seven.com/api");
curl_setopt ($curl_handle, CURLOPT_URL, " http://pro400.seen.com/api");
curl_setopt ($curl_handle, CURLOPT_HEADER, 1);

curl_setopt ($curl_handle, CURLOPT_PROXY, $proxy);
//curl_setopt ($curl_handle, CURLOPT_PROXYPORT, 8080);
//curl_setopt ($curl_handle, CURLOPT_HTTPPROXYTUNNEL,1);
//curl_setopt ($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt ($curl_handle, CURLOPT_POST, 1);
curl_setopt ($curl_handle, CURLOPT_POSTFIELDS, $data_string);
//curl_setopt ($curl_handle, CURLOPT_TIMEOUT, 1);

#$result = curl_exec ($curl_handle) or die ("There has been an error");
$result = curl_exec ($curl_handle);

if (curl_error($curl_handle))
{
  printf("Error %s: %s", curl_errno($curl_handle),
curl_error($curl_handle));
  die (" ->> There has been an error");
}
curl_close ($curl_handle);
echo $result;
?>

Thank you very much!!

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-12-01