loading...

TrackingURLs - A ColdFusion function to parse Shipping Tracking Numbers

twitter logo ・1 min read

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#">
<cfelse>
       <cfoutput>
              <p>Sorry. Tracking number "#EncodeForHTML(Form.TrackingNumber)#" seems invalid.</p>
       </cfoutput>
</cfif>

GitHub Project

GitHub logo JamoCA / TrackingURLs

A ColdFusion CFC to parse & identify ship tracking numbers.

TrackingURLs

A ColdFusion CFC to parse & identify ship tracking numbers.

<cfscript>
TrackingURLs = new TrackingURLs();

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

result = TrackingURLs.getTrackingInfo(Form.TrackingNumber);

if (request.isURL(result.url)){
    //location(result.url);
    writedump(result);
} 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>");
</cfscript>
twitter logo DISCUSS
Classic DEV Post from Jun 12 '19

What are your favorite Linux utility/productivity tools?

I love Linux and one thing I love about it is that you can set it up just right for yourself to make...

James Moberg profile image
I’m a ColdFusion web application developer at SunStar Media located in Monterey, CA. I am a fan of technology, music and web development.

Tip: You can configure your dev.to reading experience, such as using sans serif fonts.

Go to your the "misc." section of your settings.

Customize dev.to