Title: Error on API Connection Status
Last modified: November 17, 2023

---

# Error on API Connection Status

 *  Resolved [codelad](https://wordpress.org/support/users/codecorun/)
 * (@codecorun)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/)
 * Hi Support,
   My client is having this issue with their website where the status
   of API connection is **[XML2Array] Error parsing the XML string.**Please explain
   why and kindly provide some guidelines on how to solve it.Thank you.

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [Clint Johnson](https://wordpress.org/support/users/nmbgeek/)
 * (@nmbgeek)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212416)
 * I am experiencing this as well. I was using the a different plugin that also 
   stopped working so decided to give this one a try and am getting this error.
 *  Plugin Author [Grzegorz Rola](https://wordpress.org/support/users/grola/)
 * (@grola)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212426)
 * Please enable debug mode and paste here API request and response: [https://octolize.com/docs/article/usps-general-settings/#debug_mode](https://octolize.com/docs/article/usps-general-settings/#debug_mode)
 *  [Clint Johnson](https://wordpress.org/support/users/nmbgeek/)
 * (@nmbgeek)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212454)
 * I enabled debugging and the only thing I am getting is “USPS Live Rates: [XML2Array]
   Error parsing the XML string.”
 * I have disabled my cloudflare proxy, and I am also experiencing similar results
   with other USPS calculator plugins. I have tested my USPS API username and verified
   it is correct by doing a request to [https://secure.shippingapis.com/ShippingAPI.dll?API=RateV4&XML=%3CRateV4Request%20USERID=%22MY_ID_HERE%22%20PASSWORD=%22%22%3E%3CRevision%3E2%3C/Revision%3E%3CPackage%20ID=%221ST%22%3E%20%3CService%3EGROUND%20ADVANTAGE%3C/Service%3E%20%3CZipOrigination%3E30677%3C/ZipOrigination%3E%20%3CZipDestination%3E46750%3C/ZipDestination%3E%20%3CPounds%3E0%3C/Pounds%3E%20%3COunces%3E10%3C/Ounces%3E%20%3CContainer%3EVARIABLE%3C/Container%3E%20%3CWidth%3E%3C/Width%3E%20%3CLength%3E%3C/Length%3E%20%3CHeight%3E%3C/Height%3E%20%3CMachinable%3E%3C/Machinable%3E%20%3CDropOffTime%3E%3C/DropOffTime%3E%20%3CShipDate%3E2023-11-20%3C/ShipDate%3E%20%3CSortationLevel%3E%3C/SortationLevel%3E%20%3CDestinationEntryFacilityType%3E%3C/DestinationEntryFacilityType%3E%20%3CReturnFees%3Etrue%3C/ReturnFees%3E%20%3C/Package%3E%20%3C/RateV4Request%3E](https://secure.shippingapis.com/ShippingAPI.dll?API=RateV4&XML=%3CRateV4Request%20USERID=%22MY_ID_HERE%22%20PASSWORD=%22%22%3E%3CRevision%3E2%3C/Revision%3E%3CPackage%20ID=%221ST%22%3E%20%3CService%3EGROUND%20ADVANTAGE%3C/Service%3E%20%3CZipOrigination%3E30677%3C/ZipOrigination%3E%20%3CZipDestination%3E46750%3C/ZipDestination%3E%20%3CPounds%3E0%3C/Pounds%3E%20%3COunces%3E10%3C/Ounces%3E%20%3CContainer%3EVARIABLE%3C/Container%3E%20%3CWidth%3E%3C/Width%3E%20%3CLength%3E%3C/Length%3E%20%3CHeight%3E%3C/Height%3E%20%3CMachinable%3E%3C/Machinable%3E%20%3CDropOffTime%3E%3C/DropOffTime%3E%20%3CShipDate%3E2023-11-20%3C/ShipDate%3E%20%3CSortationLevel%3E%3C/SortationLevel%3E%20%3CDestinationEntryFacilityType%3E%3C/DestinationEntryFacilityType%3E%20%3CReturnFees%3Etrue%3C/ReturnFees%3E%20%3C/Package%3E%20%3C/RateV4Request%3E)
   which does work.
 * In my Nginx log I am getting `2023/11/18 16:19:55 [error] 1581#1581: *346 FastCGI
   sent in stderr: "PHP message: PHP Warning: DOMDocument::loadXML(): Start tag 
   expected, '<' not found in Entity, line: 1 in /home/runcloud/webapps/altman/wp-
   content/plugins/flexible-shipping-usps/vendor_prefixed/vinceg/usps-php-api/src/
   XML2Array.php on line 55" while reading response header from upstream, client:
   66.153.189.27, server: ``redacted`.com, request: "GET /checkout/ HTTP/2.0", upstream:"
   fastcgi://unix:/var/run/altman.sock:", host: "redacted.com", referrer: "https://`
   redacted`.com/cart/"
 *  [Clint Johnson](https://wordpress.org/support/users/nmbgeek/)
 * (@nmbgeek)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212460)
 * I’m sorry it actually is showing the debug boxes and the request is:
 *     ```wp-block-code
       <?xml version="1.0" encoding="UTF-8"?>
       <RateV4Request USERID="MY_ID_HERE">
         <Revision>2</Revision>
         <Package ID="1">
           <Service>ONLINE</Service>
           <ZipOrigination>29578</ZipOrigination>
           <ZipDestination>29566</ZipDestination>
           <Pounds>0</Pounds>
           <Ounces>6</Ounces>
           <Container></Container>
           <Machinable>true</Machinable>
         </Package>
       </RateV4Request>
       ```
   
 * The endpoint URL is: [https://secure.shippingapis.com/ShippingAPI.dll](https://secure.shippingapis.com/ShippingAPI.dll)
 *  [Clint Johnson](https://wordpress.org/support/users/nmbgeek/)
 * (@nmbgeek)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212461)
 * Sorry for the deluge of responses. When I try and submit that as a manual GET
   request (with my ID of course) I get an authentication error, but when I add 
   PASSWORD=”” after USERNAME it works successfully.
 *  Plugin Author [Grzegorz Rola](https://wordpress.org/support/users/grola/)
 * (@grola)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212463)
 * Perhaps the hosting has turned on some firewall. I just checked our demo site
   and everything works fine. You can also test it at [https://demo.octolize.com/](https://demo.octolize.com/)
 *  [Clint Johnson](https://wordpress.org/support/users/nmbgeek/)
 * (@nmbgeek)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212467)
 * The Password=”” wasn’t correct as it does work without it. The hosting is a VPS
   and I have disabled Wordfence and cloudflare but the strange thing is that curl
   requests from the server cli to the same URL that works in my browser are actually
   returning a binary response instead of text/xml.
 * Edit: the binary is actually just gzip compression
    -  This reply was modified 2 years, 6 months ago by [Clint Johnson](https://wordpress.org/support/users/nmbgeek/).
 *  [Clint Johnson](https://wordpress.org/support/users/nmbgeek/)
 * (@nmbgeek)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212497)
 * I think I am getting somewhere. USPS may be blocking Digital Ocean IPs? I have
   tried from 3 different Ubuntu servers on Digital Ocean and all have returned 
   a 401 Unauthorized response. The same curl request from my ubuntu home lab server,
   2 different Azure Ubuntus, and a hosted postman instance are all successful.
 * Confirmed: I cloned my site through runcloud to one of my Azure servers and it
   now works.
    -  This reply was modified 2 years, 6 months ago by [Clint Johnson](https://wordpress.org/support/users/nmbgeek/).
 *  Plugin Author [Grzegorz Rola](https://wordpress.org/support/users/grola/)
 * (@grola)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17212847)
 * [@nmbgeek](https://wordpress.org/support/users/nmbgeek/) can you check curl with“
   Accept-Encoding: identity” header?
 *  [Clint Johnson](https://wordpress.org/support/users/nmbgeek/)
 * (@nmbgeek)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17213321)
 * Same thing. It works on my Azure and home lab but on 3 different digital ocean
   servers I receive a binary response and if I add “–compressed” the 403 response“
   You do not have permission to access this page
   If you have found this page in
   error, please contact support”. Can’t even put in a support request to USPS because
   once I submit I get an error back as well.
 *  [jbixler](https://wordpress.org/support/users/jbixler/)
 * (@jbixler)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17215906)
 * Also having this issue on a DigitalOcean-hosted site. Anyone have any success
   with getting in touch with the USPS API team?
 *  [stoi2m1](https://wordpress.org/support/users/stoi2m1/)
 * (@stoi2m1)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17233143)
 * I am using a Droplet on Digital Ocean running Ubuntu 22.04.2 LTS and yesterday
   I was successful in configuring USPS Live Rates.
   API Connection Status **OK**

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Error on API Connection Status’ is closed to new replies.

 * ![](https://ps.w.org/flexible-shipping-usps/assets/icon.svg?rev=2737986)
 * [Shipping Live Rates for USPS for WooCommerce](https://wordpress.org/plugins/flexible-shipping-usps/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/flexible-shipping-usps/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/flexible-shipping-usps/)
 * [Active Topics](https://wordpress.org/support/plugin/flexible-shipping-usps/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/flexible-shipping-usps/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/flexible-shipping-usps/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)

 * 12 replies
 * 5 participants
 * Last reply from: [stoi2m1](https://wordpress.org/support/users/stoi2m1/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/error-on-api-connection-status/#post-17233143)
 * Status: resolved