1 (edited by ApoXX 2010-07-31 15:30:17)

Topic: Package Tracker Widget

This is the "official" thread for the Package Tracker widget. Please post any questions or suggestions pertaining to the Package Tracker widget in this thread so we can have a dialog.

Widget Link:

http://www.chumby.com/guide/widget/Package%20Tracker
http://dash.chumby.com/guide/widget/Package%20Tracker

The public tracking RSS server is currently hosted at http://www.encyphered.com/track/rss.php. Package information will be cached for 4 hours before it is retrieved from the carriers.

The following link points to the Google Code project for the PHP-based RSS tracking gateway. This is provided for users who wish to use their own server or web hosting account if they prefer the added privacy and/or the ability to reduce the cache expiration interval.

PHP class/RSS gateway: http://code.google.com/p/php-parcel-tracker/

I'm limited on time and currently looking for developers and non-developers alike to help add new features and functionality. Some ideas for features?

  • Interactive map of package locations

  • Better visual and audible indicators of package progress/status

  • Customizable notification preferences

  • Support for more carriers

  • Internationalization

  • Support for more resolutions

  • Ability to enter/edit tracking numbers from the Chumby device itself rather than browser-only

  • Consider changing scrolling physics: right now text scrolls constant speed using finger/mouse drag while the accelerometer provides acceleration, it might be nice to accelerate drags for devices without accelerometers to make scrolling through long tracking histories easier.

Re: Package Tracker Widget

Here's some brief information about the widget:

Carriers
I'm willing to add support for the major carriers in the U.S. The PHP source is published and I will be publishing the widget source code if any international folks want to write support for their own postal systems.

Cache
The widget uses 3 levels of caching: The Chumby will cache all tracking data internally as a Mobile Shared Object with a 10 minute expiration. The public RSS tracking server has a 30 minute cache interval, but this can be lowered if you configure the PHP script and place it on your own server. Finally, the PHP script sends the correct Last-modified header, leveraging the Chumby's built-in HTTP cache.

Alert
The alert isn't really documented in the widget configuration but basically when it's checked, it will sound an audible alert "You've Got Mail" when a package status changes from in-progress to delivered. The alert should only sound once, but will re-occur if you reboot the Chumby. I may add the option for custom sounds and persistent notification alerts in the future.

Why the need for a PHP script?
Currently, the PHP script is responsible for translating the HTML/XML tracking data into RSS format which is readily parsed by the Chumby. This takes some load away from the Chumby and also extends the options for caching. I could use the XML-RPC systems that most carriers provide to have the Chumby communicate with the carriers directly, but each carrier currently requires a user to register for an API key which is a step I'd prefer to avoid. Another show stopper is that most of the carriers (if not all) seem to be lacking the necessary crossdomian.xml file.

Interface
The text will scroll using the accelerometer as well as by finger touch. The timer for moving between multiple packages gets reset whenever a person physically touches the screen, allowing for more time to read tracking details.

Privacy
For maximum privacy, download the PHP script and run it on a local server or web host. The PHP script offers some security to those using the freely provided tracking server (http://chumby.freehostia.com/track.php) by using a one-way hash to store the cached tracking data files. This eliminates the need to store tracking numbers anywhere on non-chumby.com servers.

3 (edited by ApoXX 2008-03-24 21:26:46)

Re: Package Tracker Widget

Per nimocone's suggestion, I'm looking at creating a more visual experience by plotting package tracking locations on a map. Here are a few flash-based Google Maps implementations I'm exploring:

http://code.google.com/p/google-maps-flash-interface/
http://www.afcomponents.com/components/g_map/
http://vgmap.eyebeamresearch.org/

Feel free to post your thoughts and ideas. wink

Re: Package Tracker Widget

This would be seriously cool.

Re: Package Tracker Widget

Thanks for listening to my suggestion.  I love your app already and can't wait to see if you can implement this!

Re: Package Tracker Widget

Great widget, but I'm having a problem getting it to display tracking info when running the PHP script on my website as opposed to the free tracking server.

I followed the directions carefully - changed the filename to track.php and uploaded it to my webhost in its own directory. Created a directory within that directory called "cache" and gave it 777 permissions. Downloaded crossdomain.xml and stuck it in the root directory of my hosting account. There appear to be .xml files in the cache directory, but the widget on Chumby says that the tracking numbers are invalid, expired, or not yet in the system (even though these are UPS tracking numbers that do work, because I can look them up on UPS.com.)

Any idea what I might be doing wrong?

Re: Package Tracker Widget

Interesting.. it sounds like you went through the correct procedure.

Can you confirm that the tracking numbers are working with the free tracking server? Do the xml files within the cache/ directory contain errors or valid tracking data.

It's possible that something within your PHP environment is blocking the script's request to the UPS tracking server; try copying and pasting the following into a new php file and seeing what gets returned:

<?php

$trackingNumber = 'YOUR_TRACKING_NUM';

$link = 'http://wwwapps.ups.com/WebTracking/processInputRequest?tracknum=' . $trackingNumber;
echo file_get_contents($link); 

?>

Re: Package Tracker Widget

Thanks for the reply. I looked at the .xml files on my host, and they just said the same thing that the widget said (tracking number invalid, etc.) So I changed the widget back to the free tracking server, restarted the Chumby, and the widget did correctly display the tracking info for both of my 2 tracking numbers. Following that, I copied your code to a new track.php file, and replaced the one on my host with it.  Then I changed the widget to point back to the location of the file on my host again. When I did that, the first time Chumby loaded the widget, it played the "you've got mail" sound, but the display said that the widget wasn't configured correctly. Then, it just displayed "undefined" on the screen.

I guess I could use the free tracking server, just not sure what the security issues would be (if any).

Re: Package Tracker Widget

What does the new code do if you replace YOUR_TRACKING_NUM with one of your tracking numbers and visit it with a web browser?

Re: Package Tracker Widget

is it possible file_get_contents for URLs could be disabled on his server? You could use cURL instead?

Re: Package Tracker Widget

That's what I'm attempting to determine.

Re: Package Tracker Widget

A simple phpinfo() should give you all the information you need?

Check the values for allow_url_fopen

Re: Package Tracker Widget

gingerbeardman wrote:

A simple phpinfo() should give you all the information you need?

Check the values for allow_url_fopen

This would work, but it's not definitive.. for example, the server may have a proxy or firewall which is limiting the connection to UPS.com.

Re: Package Tracker Widget

I stand corrected smile

Re: Package Tracker Widget

Hey guys, thanks for the help. I went back and altered the new code so it contained my UPS tracking number in place of YOUR_TRACKING_NUM. Then I hit that URL with the browser, and I got the message shown in this screenshot. I blacked out my tracking number here, as well as one directory in the path, because it contains my full name and I didn't want to give all that away.

I admit I don't know crap about coding, so I hope this helps.

http://img369.imageshack.us/img369/7453/32634085xw9.jpg

16 (edited by ApoXX 2008-03-31 21:02:10)

Re: Package Tracker Widget

Hehe it looks like gingerbeardman was right =]

Lloyd, can you try creating a phpinfo.php file? It should contain the following:

<?php phpinfo(); ?>

Open the phpinfo.php file in your web browser, you should see the value "disabled" to the right of "allow_url_fopen". Search through the document and look for "cURL support", if it's present and the value is enabled, I should be able get the tracking script to work with your web hosting environment.

If cURL isn't present or is set to disabled, it's still possible that I could get it working by using raw sockets or by overriding your PHP config using .htaccess or ini_set().

Re: Package Tracker Widget

Here's "allow_url_fopen":   Local Value (Off) Master Value (Off)

However, cURL shows:

CURL support  enabled 
CURL Information  libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.2.3

Thanks!

Re: Package Tracker Widget

Awesome, try using the updated script: http://cyphergate.com/track.php.txt

Please ensure your browser didn't cache the older script.. You should see the new configuration parameter, retrMethod, which is set to use cURL by default.

Re: Package Tracker Widget

Uploaded the new script and it works! I tracked 2 UPS shipments and a FedEx shipment and they all display results.  Nice work, I love this widget. Thanks for your help.

Re: Package Tracker Widget

Great, glad it works! =]

Re: Package Tracker Widget

I don't know if this is a bug or a feature.. but even when i have the Alert checkbox unchecked and saved, the widget still tends to notify me with the You Got Mail sound... of updates... Not sure if thered be an easy way to make it so it doesn't go off during a certain period of the day or just be able to set it so it displays status but not alert...

Re: Package Tracker Widget

I've updated the widget and the alert checkbox is now working on my end.

I could add functionality to prevent it from going off at a certain period in the day, however, I will have to reactor the configuration widget. This may be something I add after I complete the map/visual tracking features.

Re: Package Tracker Widget

Great widget!  I think I'll be using this one a lot. 

I have one suggestion: When you get tracking numbers from UPS, they often have spaces in them, i.e.  1Z V90 R48... instead of 1ZV90R48...  If you copy and paste the tracking number with the spaces, you get the widget error message: "There was a problem communicating with the tracking server..."  It would be great if you could check for spaces in the tracking number and report a less generic error message, or better yet, have the widget simply ignore the spaces when constructing the URL.

Re: Package Tracker Widget

Thanks for reporting that hayes, I've updated the widget and it should now allow for any spaces.

I've done some experimenting with mapping package locations and was able to get G Map, which is a flash-based Google map implementation, working on the Chumby. For now, I've posted this as a standalone Google Maps widget (pending approval) and I will be experimenting with some interface layout options for the package tracker itself.

Re: Package Tracker Widget

I could really use this right now, ordered some cds off ebay a couple weeks ago and they still haven't arrived! sad