示例#1
0
ini_set('display_errors', 1);
// This is to help new users to Composer
require_once '../../vendor/autoload.php';
if (!file_exists('../config.php')) {
    die("Prepare a config.php file. See: config.php.example");
}
include '../config.php';
use AntiMattr\ShipmentTracking\Client\AfterShip\TrackingClient;
use AntiMattr\ShipmentTracking\Model\CommonTracking;
use Buzz\Client\Curl;
// See config.php.example
$apiKey = AFTERSHIP_API_KEY;
$host = 'https://api.aftership.com';
$path = '/v4';
$buzz = new Curl();
$client = new TrackingClient($apiKey, $host, $path, $buzz);
$courier = 'usps';
$number = 'xxxxxx';
$tracking = new CommonTracking();
$tracking->setCourier($courier);
$tracking->setNumber($number);
$error = '';
$success = '';
if ($_POST) {
    try {
        if (!isset($_POST['courier'])) {
            throw new \Exception("The courier was not submitted");
        }
        if (!isset($_POST['number'])) {
            throw new \Exception("The tracking number was not submitted");
        }
示例#2
0
ini_set('display_errors', 1);
// This is to help new users to Composer
require_once '../../vendor/autoload.php';
if (!file_exists('../config.php')) {
    die("Prepare a config.php file. See: config.php.example");
}
include '../config.php';
use AntiMattr\ShipmentTracking\Client\AfterShip\TrackingClient;
use AntiMattr\ShipmentTracking\Model\CommonTracking;
use Buzz\Client\Curl;
// See config.php.example
$apiKey = AFTERSHIP_API_KEY;
$host = 'https://api.aftership.com';
$path = '/v4';
$buzz = new Curl();
$client = new TrackingClient($apiKey, $host, $path, $buzz);
$courier = 'usps';
$number = 'xxxxxx';
$tracking = new CommonTracking();
$tracking->setCourier($courier);
$tracking->setNumber($number);
$error = '';
$success = '';
if ($_POST) {
    try {
        if (!isset($_POST['courier'])) {
            throw new \Exception("The courier was not submitted");
        }
        if (!isset($_POST['number'])) {
            throw new \Exception("The tracking number was not submitted");
        }
示例#3
0
ini_set('display_errors', 1);
// This is to help new users to Composer
require_once '../../vendor/autoload.php';
if (!file_exists('../config.php')) {
    die("Prepare a config.php file. See: config.php.example");
}
include '../config.php';
use AntiMattr\ShipmentTracking\Client\AfterShip\TrackingClient;
use AntiMattr\ShipmentTracking\Model\CommonTracking;
use Buzz\Client\Curl;
// See config.php.example
$apiKey = AFTERSHIP_API_KEY;
$host = 'https://api.aftership.com';
$path = '/v4';
$buzz = new Curl();
$client = new TrackingClient($apiKey, $host, $path, $buzz);
$number = 'xxxxxx';
$tracking = new CommonTracking();
$tracking->setNumber($number);
$error = '';
$success = '';
if ($_POST) {
    try {
        if (!isset($_POST['number'])) {
            throw new \Exception("The tracking number was not submitted");
        }
        $number = $_POST['number'];
        $tracking->setNumber($number);
        $client->create($tracking);
        $success = 'Tracking has been created for your shipment.';
    } catch (\Exception $e) {