Social Networking/E-Commerce Web Design & Development

rss

PHP / mySQL / xml / xHTML / CSS / DOM - By Dennis Plucinik

Google



How to Become a Rockstar Freelancer book

My Portfolio:


Does anyone else have problems with the USPS Shipping Rates API?

I’ve spend the the last couple days designing and developing the shopping cart/billing/shipping section of AtomicCoffeeShop.com which includes integration with the United States Postal Service’s API.

In theory it sounds pretty cool, but in actuality, it’s only been up and running for me for a day or so and I’m already coming across problems. In testing alone, their server seems like it’s down. I’m getting a lovely “HTTP request failed!” error.

The company I work for now uses a rate chart hard coded into a database and generates rates at checkout that way, though it seems like a more clever and more accurate way just to just use the USPS API (as well as the UPS API once I get the USPS one down first). I’m just curious, who has experience with this and can you give any advice as to what route you would take. Also, what is everyone’s experience with using the UPS API? Is it reliable, etc.? What types of fallback plans do you guys use to catch when their servers go down and resort to a backup rate check?

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]

2 Comments, Comment or Ping

  1. gravatar

    Mike

    Having the same problem with PHP4, ‘file_get_contents’ and USPS.

    You can get back a request from their servers using PHP5 and ’simplexml_load_file’… if you’re using PHP5, let me know and I can send over a working example.

  2. gravatar

    Mike

    I found the solution!

    You need to urlencode() the actual XML string you’re passing in your file_get_contents() function. It would go something like this…

    $returned_xml = ‘http://Production.ShippingAPIs.com/ShippingAPI.dll’.urlencode($your_xml_string);

    That should do the trick.

Reply to “Does anyone else have problems with the USPS Shipping Rates API?”