create() public static method

create a tracker
public static create ( mixed $params = null, string $apiKey = null ) : mixed
$params mixed
$apiKey string
return mixed
Esempio n. 1
0
<?php

require_once "../lib/easypost.php";
\EasyPost\EasyPost::setApiKey('cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi');
$tracking_code = "EZ2000000002";
$carrier = "USPS";
$tracker = \EasyPost\Tracker::create(array('tracking_code' => $tracking_code, 'carrier' => $carrier));
print_r($tracker);
$tracker2 = \EasyPost\Tracker::retrieve($tracker->id);
print_r($tracker2);
Esempio n. 2
0
 public function get_tracking($track_code)
 {
     $est_date = $status = $signed_by = $update_at = '';
     $carrier = 'DHLExpress';
     $tracker = \EasyPost\Tracker::create(array('tracking_code' => $track_code, 'carrier' => $carrier));
     $tracker = $tracker->__toArray(true);
     if (!empty($tracker['est_delivery_date'])) {
         $est_date = $tracker['est_delivery_date'];
     }
     if (!empty($tracker['signed_by'])) {
         $signed_by = $tracker['signed_by'];
     }
     $status = $tracker['status'];
     $source = array('T', 'Z');
     $dest = array(' ', '');
     $update_at = str_replace($source, $dest, $tracker['updated_at']);
     $result = array('shp_estdate' => $est_date, 'shp_status' => $status, 'shp_updateat' => $update_at, 'shp_signedby' => $signed_by);
     $where = array('shp_trackingcode', $track_code);
     $this->update($result, $where);
     return $tracker['tracking_details'];
 }
Esempio n. 3
0
<?php

require_once "../lib/easypost.php";
\EasyPost\EasyPost::setApiKey('cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi');
$tracking_code = "9611913638261560007008";
$tracker = \EasyPost\Tracker::create(array('tracking_code' => $tracking_code));
// $tracker = \EasyPost\Tracker::create(array('tracking_code' => $tracking_code, 'carrier' => 'fedexsmartpost'));
// $tracker = \EasyPost\Tracker::retrieve('trk_xxxxxxxx');
print_r($tracker);