Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

glampkin

Archived
  • Posts

    4
  • Joined

  • Last visited

Profile Information

  • Real Name
    Greg Lamp

glampkin's Achievements

  1. Hi Satish: Here is the first part of the code: $request = 'API=IntlRate&XML=' . urlencode($request); } switch (MODULE_SHIPPING_USPS_SERVER) { case 'production': $usps_server = 'production.shippingapis.com'; $api_dll = 'shippingapi.dll'; break; case 'test': default: $usps_server = 'testing.shippingapis.com'; $api_dll = 'ShippingAPITest.dll'; break; } $body = ''; $http = new httpClient(); if ($http->Connect($usps_server, 80)) { $http->addHeader('Host', $usps_server); $http->addHeader('User-Agent', 'osCommerce'); $http->addHeader('Connection', 'Close'); if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody(); $http->Disconnect(); } else { return false; } $response = array(); while (true) { if ($start = strpos($body, '<Package ID=')) { $body = substr($body, $start); $end = strpos($body, '</Package>'); $response[] = substr($body, 0, $end+10); $body = substr($body, $end+9); } else { break; } } $rates = array(); if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) { if (sizeof($response) == '1') { if (ereg('<Error>', $response[0])) { $number = ereg('<Number>(.*)</Number>', $response[0], $regs); $number = $regs[1]; $description = ereg('<Description>(.*)</Description>', $response[0], $regs); $description = $regs[1]; return array('error' => $number . ' - ' . $description); } } $n = sizeof($response); for ($i=0; $i<$n; $i++) { if (strpos($response[$i], '<Postage>')) { $service = ereg('<Service>(.*)</Service>', $response[$i], $regs); $service = $regs[1]; $postage = ereg('<Postage>(.*)</Postage>', $response[$i], $regs); $postage = $regs[1]; $rates[] = array($service => $postage); } } } else { if (ereg('<Error>', $response[0])) { $number = ereg('<Number>(.*)</Number>', $response[0], $regs); $number = $regs[1]; $description = ereg('<Description>(.*)</Description>', $response[0], $regs); $description = $regs[1]; return array('error' => $number . ' - ' . $description); } else { $body = $response[0]; $services = array(); while (true) { if ($start = strpos($body, '<Service ID=')) { $body = substr($body, $start); $end = strpos($body, '</Service>'); $services[] = substr($body, 0, $end+10); $body = substr($body, $end+9); } else { break; } } $size = sizeof($services); for ($i=0, $n=$size; $i<$n; $i++) { if (strpos($services[$i], '<Postage>')) { $service = ereg('<SvcDescription>(.*)</SvcDescription>', $services[$i], $regs); $service = $regs[1]; $postage = ereg('<Postage>(.*)</Postage>', $services[$i], $regs); $postage = $regs[1]; if (isset($this->service) && ($service != $this->service) ) { continue; } $rates[] = array($service => $postage); } } } } I can net find an var_dump $response after line 140. Maybe this is the problem? Thanks for all, glampkin
  2. Thanks Satish, but where do I find the module quote. Do you know the path? Is it a .php file? Please let me know, I'll be glad to post it.
  3. Hi Cristina, I called the USPS and they did switch me over to the production server. They say everything is fine on there side. Do you know what else it could be? Thanks,
  4. I am having some problems with my the usps shipping calculation. I am getting this message at the check out box: "An error occured with the USPS shipping calculations. If you prefer to use USPS as your shipping method, please contact the store owner." I have asked the USPS to change me over to the production server but am still having the same issue. I'm using USPS shipping lables 2.04. Can anyone help me? Thanks
×
×
  • Create New...