curl-and-php
Odd cURL problem....
Date: Fri, 22 Mar 2002 17:05:34 -0600
Alright, so here's my code right now:
-------------------------------------------------------------
function newSend($info){
echo "<b>Using curl socket on test site...</b><br>";
echo "<b>Sent XML:</b> ".htmlspecialchars($info)."<Br>"; flush();
$ch = curl_init();
$DeveloperName="foo";
$ApplicationName="test";
$SessionCertificate="bar";
$cert="X-EBAY-API-SESSION-CERTIFICATE:".$DeveloperName.";".$ApplicationName.
";".$SessionCertificate;
$compat="X-EBAY-API-COMPATIBILITY-LEVEL:237";
$headers[]=$cert."\r\n\r\n".$compat."\r\n\r\n";
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_URL, "https://test.server.com/aw-cgi/API.dll?");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $info);
curl_setopt($ch, CURLOPT_POST, 1);
$test=curl_exec($ch);
echo "Info:".$test."<p>";
if(curl_error($ch)){
echo curl_error($ch);
}
curl_close ($ch);
return $test;
}
-------------------------------------------------------------
Now, this works all well and good, but it's not the right way to do
it.....to do it right, I have to POST the XML ($info) that I want to send to
that same URL - something like:
curl_setopt($ch, CURLOPT_URL, "https://test.server.com/aw-cgi/API.dll");
curl_setopt($ch, CURLOPT_POSTFIELDS, $info);
But that doesn't POST the info correctly and doesn't give me any response
from the server....
Any ideas on how I could make this thing work?
-chris
developer_at_catalog.com
Received on 2002-03-23