I have a sample PHP script where I am posting data to UPS using curl, and then getting the data returned. The problem I am having is when I get curl_exec to pull the data and store it in a variable, it is actually printing it out on the web page. Does someone see a problem with this script on why its pulling the data and printing it instead of storing in the $result variable?
$xmlRequest = "<?xml version=\"1.0\"?>\n".
"<AccessRequest>\n".
" <AccessLicenseNumber>" . $LicenseNumber . "</AccessLicenseNumber>\n".
" <UserId>" . $Username . "</UserId>\n".
" <Password>" . $Password . "</Password>\n".
"</AccessRequest>\n".
"<?xml version=\"1.0\"?>\n".
"<AddressValidationRequest xml:lang=\"en-US\">\n".
" <Request>\n".
" <TransactionReference>\n".
" <CustomerContext>MarketingWebForce.com</CustomerContext>\n".
" <XpciVersion>1.0001</XpciVersion>\n".
" </TransactionReference>\n".
" <RequestAction>AV</RequestAction>\n".
" </Request>\n".
" <Address>\n";
$xmlRequest .= " <City>Oklahoma City</City>\n";
$xmlRequest .= " <StateProvinceCode>OK</StateProvinceCode>\n";
$xmlRequest .= " <PostalCode>73142</PostalCode>\n";
$xmlRequest .= " </Address>\n".
"</AddressValidationRequest>";
//set POST variables
$url = 'https://wwwcie.ups.com/ups.app/xml/AV';
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,'1');
curl_setopt($ch,CURLOPT_POSTFIELDS,$xmlRequest);
[color=red]//execute post
echo "<hr>PULLING DATA<br>";
$result = curl_exec($ch);
echo "<hr>DATA PULLED<br>";[/color]
//close connection
curl_close($ch);
echo "<hr>PRINTING DATA<br>";
print_r($result);
echo "<hr>DATA PRINTED<br>";