PHP Class Example 

  • The class of api
    //www.trackingmore.com/api-class_php.html

        Installation:
            1. Download this Class to desired location
            2. Fill in Trackingmore-Api-Key in this Class in line "protected $apiKey = 'YOUR API KEY';"
            3. Require this class in your project.


    List all carriers
    $track = new Trackingmore;
    $track = $track->getCarrierList();
    
    Detect a carrier by tracking code
    $track = new Trackingmore;
    $trackingNumber = 'RM121546236CN';
    $track = detectCarrier($trackingNumber);
    
    List all trackings
    $track = new Trackingmore;
    $page = 1;
    $limit = 50;
    $createdAtMin = time() - 7*24*60*60;
    $createdAtMax = time();
    $track = $track->getTrackingsList($page,$limit,$createdAtMin,$createdAtMax);
    
    Create a tracking item
    $track = new Trackingmore;
    $extraInfo['title']          = 'iphone6';
    $extraInfo['customer_name']  = 'charse chen';
    $extraInfo['customer_email'] = [email protected]';
    $extraInfo['order_id']       = '8988787987';
    $track = $track->createTracking('china-post','RM121516216CN',$extraInfo);
    
    Create multiple trackings.
    $track = new Trackingmore;
    $items = array(
        array(
    		'tracking_number' => 'RM131516216CN',
    		'carrier_code'    => 'china-post',
    		'title'          => 'iphone6',
    		'customer_name'   => 'charse chen',
    		'customer_email'  => [email protected]',
    		'order_id'      => '8988787987'
    	),
    	array(
    		'tracking_number' => 'RM111516216CN',
    		'carrier_code'    => 'china-post',
    		'title'          => 'iphone6s',
    		'customer_name'   => 'clooney chen',
    		'customer_email'  => [email protected]',
    		'order_id'      => '898874587'
    	),
    );
    $track = $track->createMultipleTracking($items);
    
    Get tracking results of a single tracking.
    $track = new Trackingmore;
    
    $track = $track->getSingleTrackingResult('china-post','RM131516216CN');
    
    Update Tracking item
    $track = new Trackingmore;
    $extraInfo['title']          = 'iphone6';
    $extraInfo['customer_name']  = 'charse chen';
    $extraInfo['customer_email'] = [email protected]';
    $extraInfo['order_id']       = '8988787987';
    $track = $track->updateTrackingItem('china-post','RM131516216CN',$extraInfo);
    
    Delete a tracking item
    
    $track = new Trackingmore;
    $track = $track->deleteTrackingItem('china-post','RM131516216CN');
    
    Get realtime tracking results of a single tracking
    
    $track = new Trackingmore;
    $track = $track->getRealtimeTrackingResults('china-post','RM131516216CN');