7

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.

Nathan H
  • 48,033
  • 60
  • 165
  • 247
  • I'm looking to detect at least USPS, UPS, FEDEX and DHL. Ideally more if I can... – Nathan H Jun 22 '11 at 08:09
  • possible duplicate of [Regular Expression patterns for Tracking numbers](http://stackoverflow.com/questions/619977/regular-expression-patterns-for-tracking-numbers) – Deduplicator Jun 27 '15 at 20:06

3 Answers3

7

See Regular Expression patterns for Tracking numbers

Community
  • 1
  • 1
Femi
  • 64,273
  • 8
  • 118
  • 148
4

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.

Daniel Sposito
  • 448
  • 1
  • 4
  • 13
  • Good resource. Regex's used there are pretty generic, but still accurately determine the carrier because of the way he nested the if/elses – Aaron Gillion Jun 27 '15 at 11:05
1

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.

ddinchev
  • 33,683
  • 28
  • 88
  • 133