sauladam / shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.
93 stars 32 forks source link

Fatal error when tracking FedEx package #30

Open s22-tech opened 2 years ago

s22-tech commented 2 years ago

Using a very simple test script:

require_once 'vendor/autoload.php';
use Sauladam\ShipmentTracker\ShipmentTracker;

$tracker = ShipmentTracker::get('FedEx');
$track = $tracker->track('123456789123');

it returns the following error:

Fatal error: Uncaught Exception: Could not fetch tracking data for [123456789123]. in /Users/php/track/sauladam/vendor/sauladam/shipment-tracker/src/Trackers/Fedex.php:30
Stack trace:
#0 /Users/php/track/sauladam/vendor/sauladam/shipment-tracker/src/Trackers/AbstractTracker.php(74): Sauladam\ShipmentTracker\Trackers\Fedex->fetch('https://www.fed...')
#1 /Users/php/track/sauladam/track.php(14): Sauladam\ShipmentTracker\Trackers\AbstractTracker->track('123456789123')
#2 {main}
  thrown in /Users/php/track/sauladam/vendor/sauladam/shipment-tracker/src/Trackers/Fedex.php on line 30

Any idea what's going wrong?

Thanks

s22-tech commented 2 years ago

I installed the php-fedex-api-wrapper from Jeremy Dunn and that one works for me, so the problem I described above isn't with my account info.

andlabs commented 2 years ago

According to https://gist.github.com/Ajithkumarsekar/10b5733173613865a69a43439487c2fe?permalink_comment_id=4105182#gistcomment-4105182 FedEx has completely turned down that API endpoint. They do have an OAuth-authenticated new API to use instead, but I have not personally tried signing up for it yet, and... yeah, API tokens. The library the OP linked in their second post requires those, so I think they're fine, at least.

Some of the couriers that offer API keys don't offer them to private individuals, only businesses; let's just hope this isn't one of them.

I can understand the desire to prevent abuse and data mining but this is getting really annoying. I don't want emails and text messages. I want a nice human-readable plain-text table that lists the status and estimate of all the shipments I'm expecting as a private individual non-business recipient from multiple couriers aggregated together on my computer. Apparently that's too much to ask nowadays, and I will not easily believe humanity is so brain-rotted by text message updates that I am alone in this.