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

curl-and-php

a question about curl and php

From: Zheng Sun <Zheng.Sun_at_SCHOBER.DE>
Date: Thu, 27 Feb 2003 13:43:35 +0100

Hi Folksl,

i get a trouble in curl.. :((

please help me..

it returns no errors.. it just keeps connecting to server and nothing returns..

i used fopen() to handle this and it works very well.. the reason why i try it again in curl because i have to post them to https site instead of http site which fopen() can never do it alone..

btw: i can not find even one example about php post data to server side through a proxy server.. sounds it's a untouchable area.. :((

###################################################
<?php
$http_method = 'http';
$hostname = 'www.schober.com';
$cgi = '/pm/FormRequestListener';

$proxy = 'http://sdm-bm1.schober.de';
$proxypwd = base64_encode("****:****");
#$proxypwd = "dssys,dssys";

$XMLRequest = '<?xml version="1.0" encoding="ISO-8859-1"?>\n';
$XMLRequest .= '<AddressMessage xmlns="http://paymaster.schober.com/AddressMessage">\n';
$XMLRequest .= ' <Header>\n';
$XMLRequest .= ' <Activity/>\n';
$XMLRequest .= ' <ClientId>web-test</ClientId>\n';
$XMLRequest .= ' <TransactionId>1234-consumer</TransactionId>\n';
$XMLRequest .= ' </Header>\n';
$XMLRequest .= ' <Body>\n';
$XMLRequest .= ' <Address>\n';
$XMLRequest .= ' <Street>street</Street>\n';
$XMLRequest .= ' <StreetNumber>9</StreetNumber>\n';
$XMLRequest .= ' <ZIP>72076</ZIP>\n';
$XMLRequest .= ' <City>Tuebingen</City>\n';
$XMLRequest .= ' <Country>DE</Country>\n';
$XMLRequest .= ' </Address>\n';
$XMLRequest .= ' <Person>\n';
$XMLRequest .= ' <FirstName>Manfred</FirstName>\n';
$XMLRequest .= ' <LastName>Schrems</LastName>\n';
$XMLRequest .= ' </Person>\n';
$XMLRequest .= ' </Body>\n';
$XMLRequest .= '</AddressMessage>\n';

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

$data_string = "ServiceId=".$ServiceId."&XMLRequest=".$XMLRequest;

$curl_handle = curl_init ("http://www.schober.com/pm/FormRequestListener");
#curl_setopt ($curl_handle, CURLOPT_URL, $http_method . '://'. $hostname . $cgi);
#curl_setopt ($curl_handle, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");

curl_setopt ($curl_handle, CURLOPT_PROXY, $proxy);
curl_setopt ($curl_handle, CURLOPT_PROXYPORT, 8080);
curl_setopt ($curl_handle, CURLOPT_PROXYUSERPWD, $proxypwd);
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;
?>
################################################

with best wishes

sun

-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld http://www.vasoftware.com
Received on 2003-02-27