Script to detect shipping carrier by tracking number

17,342

Solution 1

See Regular Expression patterns for Tracking numbers

Solution 2

I recently ran into the same need and have started an open source project called Argo: https://github.com/dsposito/argo

Argo determines the shipping carrier and provider (3rd party such as Endicia or Stamps.com) for a given tracking code.

Solution 3

I don't know about library but with some searching I found question similar to yours: http://answers.google.com/answers/threadview/id/207899.html

The FedEX, UPS, USPS and AIRBORNE formats are described very well and it won't be hard to write some static methods in a class to validate against them. But you haven't noted which carriers you want to detect, which country, etc, so it might not be of much help.

Share:
17,342
Nathan H
Author by

Nathan H

Soluto #SOreadytohelp

Updated on June 28, 2022

Comments

  • Nathan H
    Nathan H almost 2 years

    I've seen several websites that can detect who is the shipping carrier based on the tracking number. Is there an open library or code somewhere that can help me achieve this?

    Preferably PHP but I can probably port it if not.

  • Aaron Gillion
    Aaron Gillion almost 9 years
    Good resource. Regex's used there are pretty generic, but still accurately determine the carrier because of the way he nested the if/elses