DEV Community

James Moberg
James Moberg

Posted on

TrackingURLs - A ColdFusion function to parse Shipping Tracking Numbers

Just a quick post regarding TrackingURLs, a ColdFusion CFC to identify shipping tracking numbers (UPS, USPS, Fedex, OnTrac, DHL, S10) and generate a tracking URL.

Sample Integration

<cfset TrackingURLs = new TrackingURLs()>

<cfset result = TrackingURLs.getTrackingInfo(Form.TrackingNumber)>
<cfif request.isURL(result.url)>
       <cf_newlocation url="#result.url#">
              <p>Sorry. Tracking number "#EncodeForHTML(Form.TrackingNumber)#" seems invalid.</p>
Enter fullscreen mode Exit fullscreen mode

GitHub Project

GitHub logo JamoCA / TrackingURLs

A ColdFusion CFC to parse & identify ship tracking numbers.


A ColdFusion CFC to parse & identify ship tracking numbers.

TrackingURLs = new TrackingURLs();

cfparam(name="Form.TrackingNumber", default="");

result = TrackingURLs.getTrackingInfo(Form.TrackingNumber);

if (request.isURL(result.url)){
} else {
    writeoutput("<p>Sorry. Tracking number "#EncodeForHTML(Form.TrackingNumber)#" seems invalid.</p>");

writeOutput("<p>isFedex = #TrackingURLs.isFedex(Form.TrackingNumber)#</p>");

writeOutput("<p>isUSPS = #TrackingURLs.isUSPS(Form.TrackingNumber)#</p>");

writeOutput("<p>isDHL = #TrackingURLs.isDHL(Form.TrackingNumber)#</p>");

writeOutput("<p>isS10 = #TrackingURLs.isS10(Form.TrackingNumber)#</p>");

writeOutput("<p>isOnTrac = #TrackingURLs.isOnTrac(Form.TrackingNumber)#</p>");

Top comments (2)

windzbazel profile image

"Sounds interesting! Could you provide more details or perhaps a brief overview of how the jrs tracking example URLs ColdFusion function works? Thanks!"

gamesover profile image
James Moberg

The ColdFusion TreackingURL CFC doesn't currently support "JRS Tracking". Are you requesting support that support be added? If so, I'll need to see a pattern of their "Philippines JRS Express Tracking number / Airbill No / OR Number / BC number" in order to add support. Are their tracking numbers distinct from other services?