PHP code example of dinja / mytnt-express-connect-italy

1. Go to this page and download the library: Download dinja/mytnt-express-connect-italy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dinja / mytnt-express-connect-italy example snippets


use thm\tnt_ec\service\ShippingService\ShippingService;

$timestamp = new \DateTime();
$timezone = new \DateTimeZone('Europe/Rome');
$timestamp->setTimezone($timezone);

$shipping = new ShippingService('User ID', 'Password');

$shipping->setAccountNumber('') // will be provided by your TNT representative.
         ->setSenderAccId(''); // will be provided by your TNT representative.

$c1 = $shipping->addConsignment()->setConReference('')
                                 ->setContype('T')
                                 ->setPaymentind('S') // who pays for shipping S-sender, R-receiver
                                 ->setItems(1)
                                 ->setTotalWeight("00001000")
                                 ->setTotalVolume(0.00)
                                 ->setPackagetype('C')
                                 ->setDivision('D')
                                 ->setCollectionDate($timestamp->format('Ymd'))
                                 ->setService('N'); // will be provided by your TNT representative.

$c1->setSender()->setCompanyName('Your company')
                ->setAddressLine('Address 1')
                ->setCity('')
                ->setPostcode('')
                ->setProvince('')
                ->setCountry('')
                ->setContactDialCode('')
                ->setContactPhone('')
                ->setContactEmail('');

$c1->setReceiver()->setCompanyName('Receiver address. NOT DELIVERY!')
                  ->setAddressLine('')
                  ->setCity('')
                  ->setPostcode('')
                  ->setProvince('')
                  ->setCountry('')
                  ->setContactDialCode('')
                  ->setContactPhone('')
                  ->setContactEmail('');

$response = $shipping->send();

use thm\tnt_ec\service\ShippingService\ShippingService;

$timestamp = new \DateTime();
$timezone = new \DateTimeZone('Europe/Rome');
$timestamp->setTimezone($timezone);

$shipping = new ShippingService('User ID', 'Password');

$shipping->setAccountNumber('') // will be provided by your TNT representative.
         ->setSenderAccId(''); // will be provided by your TNT representative.

$c1 = $shipping->addConsignment()->setConAction("D")
               ->setConNumber('tracking_number'); // Shipment Number to delete

$response = $shipping->send();

use thm\tnt_ec\service\TrackingService\TrackingService;

$ts = new TrackingService('User ID', 'Password');
$ts->setAccountNumber('');  // will be provided by your TNT representative.

$response = $ts->searchByConsignment(array('tracking_number')); // Shipment Number to search