<?php /** * @file * Exemple of exporting Borderou. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'data' => date('d.m.Y', time()), 'mode' => 0, 'language' => 'ro']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('exportBorderou'); $endpoint->setParams($params); $endpoint->noHeader(); $result = $endpoint->getResult(); foreach ($result as $key => $value) { print_r(str_getcsv($value)); } } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of getting the distance info. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'judet' => 'Mures', 'language' => 'ro']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('Localitati'); $endpoint->setParams($params); $endpoint->noHeader(); $result = $endpoint->getResult(); foreach ($result as $key => $value) { print_r(str_getcsv($value)); } } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple od exporting Transfers. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'data' => date('d.m.Y', time()), 'language' => 'ro']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('exportTransfers'); $endpoint->setParams($params); $endpoint->noHeader(); $result = $endpoint->getResult(); foreach ($result as $key => $value) { print_r(str_getcsv($value)); } } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of tracking AWB. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => 7032158, 'pers_contact' => 'Aron Palmarsson', 'tel' => 07, 'email' => '*****@*****.**', 'greutate' => 1, 'inaltime' => 10, 'lungime' => 10, 'latime' => 10, 'ora_ridicare' => '18:00', 'observatii' => '']; // nr_colete or nr_plicuri must be provided. $params['nr_colete'] = 1; //Optional params if the lifting address is diferent from client address. $optionals = ['client_exp' => 'John Travolta', 'strada' => 'Targului', 'nr' => 1, 'bloc' => 2, 'scara' => 3, 'etaj' => 7, 'ap' => 78, 'localitate' => 'Targu Mures', 'judet' => 'Mures']; $params = array_merge($params, $optionals); $fc = new fanCourier(); $endpoint = $fc->getEndpoint('newOrder'); $endpoint->setParams($params); print_r($endpoint->getResult()); } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple od exporting Orders. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'data' => date('d.m.Y', time()), 'language' => 'ro']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('exportOrders'); $endpoint->setParams($params); $endpoint->noHeader(); $result = $endpoint->getResult(); foreach ($result as $key => $value) { print_r(str_getcsv($value)); } } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple od exporting Borderou. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('finalizareBorderou'); $endpoint->setParams($params); print_r($endpoint->getResult()); } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple to get AWB errors. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('awbErrors'); $endpoint->setParams($params); $endpoint->noHeader(); $result = $endpoint->getResult(); foreach ($result as $key => $value) { print_r(str_getcsv($value)); } } catch (Exception $exc) { echo $exc->getMessage(); }
* Exemple of tracking AWB. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => 7032158, 'serviciu' => 'standard']; // For internal services $params += ['localitate_dest' => 'Targu Mures', 'judet_dest' => 'Mures', 'plicuri' => 1, 'colete' => 2, 'greutate' => 5, 'lungime' => 10, 'latime' => 10, 'inaltime' => 10, 'val_decl' => 600, 'plata_ramburs' => 'destinatar']; $params['plata_la'] = 'destinatar'; // Optional: destinatar or expeditor. // For export services /*$params += [ 'modtrim' => '????', 'greutate' => 10.22, 'pliccolet' => 3, 's_inaltime' => 50, 's_latime' => 67, 's_lungime' => 48, 'volum' => 400, 'dest_tara' => 'Bulgaria', 'tipcontinut' => 1, 'km ext' => 400, ];*/ $fc = new fanCourier(); $endpoint = $fc->getEndpoint('Price'); //$endpoint->setType('export'); FOR EXPORT $endpoint->setParams($params); print_r($endpoint->getResult()); } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of scan AWB. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'AWB' => 2046600120094, 'language' => 'ro']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('scanAwb'); $endpoint->setParams($params); $endpoint->noHeader(); print_r($endpoint->getResult()); } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of geting the streets. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'judet' => 'Mures', 'localitate' => 'Targu Mures', 'language' => 'ro']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('Strazi'); $endpoint->setParams($params); $endpoint->noHeader(); $result = $endpoint->getResult(); foreach ($result as $key => $value) { print_r(str_getcsv($value)); } } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of deleting AWB. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'AWB' => '2046600120096']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('deleteAwb'); $endpoint->setParams($params); print_r($endpoint->getResult()); } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of getting the services. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('Servicii'); $endpoint->setParams($params); $endpoint->noHeader(); print_r($endpoint->getResult()); } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of print AWB as HTML or PDF. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'nr' => '2046600120090']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('printAwb'); //HTML $params['type'] = NULL; // Optional 2 for A6 $endpoint->setParams($params); print_r($endpoint->getResult()); //OR PDF // $endpoint->setType('pdf'); // $params['page'] = 'A5'; // Optional -> Pdf page type: A4,A5,A6 // $params['type'] = '0'; // Optional -> 0 or 1, if page A6 type=1 // $params['label'] = '1'; // Optional // $endpoint->setParams($params); // header('Content-type: application/pdf'); // //Do not print alongside HTML result (will fail to load PDF) // print_r($endpoint->getResult()); } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of getting the notifications. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('Observatii'); $endpoint->setParams($params); $endpoint->noHeader(); $result = $endpoint->getResult(); foreach ($result as $key => $value) { echo $value . "<br/>\r\n"; } } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of tracking AWB. */ if (file_exists(__DIR__ . '/../../../../autoload.php')) { //Downloded via packagist.org - "composer require curier/fancourier" include_once __DIR__ . '/../../../../autoload.php'; } elseif (__DIR__ . '/../../vendor/autoload.php') { //Downloded via github (git or package) include_once __DIR__ . '/../../vendor/autoload.php'; } use FanCourier\fanCourier; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158', 'AWB' => '2046600120090', 'display_mode' => '1', 'language' => 'ro']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('awbUrmarire'); $endpoint->setParams($params); print_r($endpoint->getResult()); } catch (Exception $exc) { echo $exc->getMessage(); }
<?php /** * @file * Exemple of generating new AWB. */ include_once __DIR__ . '/example_autoload.php'; use FanCourier\fanCourier; use FanCourier\Plugin\csv\csvItem; try { $params = ['username' => 'clienttest', 'user_pass' => 'testare', 'client_id' => '7032158']; $fc = new fanCourier(); $endpoint = $fc->getEndpoint('awbGenerator'); $endpoint->createFile(); $item1 = csvItem::newItem(); $item1->setItem('tip', 'standard'); $item1->setItems(['localitate' => 'Targu Mures', 'judet' => 'Mures', 'strada' => 'Aleea Carpati', 'nr' => '1']); $item1->setItems(['telefon' => '0758099432']); $item1->setItems(['nume_destinatar' => 'Name 1', 'plata_expeditii' => 'destinatar']); $item1->setItems(['greutate' => '1', 'nr_colet' => 1]); $endpoint->addNewItem($item1); $item2 = csvItem::newItem(); $item2->setItem('tip', 'standard'); $item2->setItems(['localitate' => 'Targu Mures', 'judet' => 'Mures', 'strada' => 'Aleea Carpati', 'nr' => '1']); $item2->setItems(['telefon' => '0758099432']); $item2->setItems(['nume_destinatar' => 'Name 2', 'plata_expeditii' => 'destinatar']); $item2->setItems(['greutate' => '1', 'nr_colet' => 1]); $endpoint->addNewItem($item2); //print_r($endpoint->csvToText()); $params['fisier'] = $endpoint->getFile(); $endpoint->setParams($params);