Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

UPS Return on Web


Fire59

Recommended Posts

Has anyone use the UPS Return on Web? A client has requested this feature and I've been playing around with it and not having any luck. If you have some tips or code snipplet let me know :)

Here's my PHP so far. I'm just trying to post the info to UPS test server.

<?php
include("ups_xmlparser.php");
$fp = fopen("ups_return_header.xml", "r");
while (!feof($fp))
{
$tempstr = trim(fread($fp, 1024));
$tempstr = preg_replace('/[\n\r\t]/','',$tempstr);
$tempstr = preg_replace('/  /','',$tempstr);
$xmlstr .= searchFields($tempstr);
}
fclose($fp);
$fp = fopen("ups_return_body.xml", "r");
while (!feof($fp))
{
$tempstr = trim(fread($fp, 1024));
$tempstr = preg_replace('/[\n\r\t]/','',$tempstr);
$tempstr = preg_replace('/  /','',$tempstr);
$xmlstr .= searchFields($tempstr);
}
fclose($fp);
// cURL ENGINE
$ch = curl_init(); /// initialize a cURL session
curl_setopt ($ch, CURLOPT_URL,"https://wwwcie.ups.com/ups.app/xml/Return");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlstr);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$xyz = curl_exec ($ch);
curl_close ($ch);
echo $xyz;
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...