50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to a commercial license.
|
|
* Use, copy, modification or distribution of this source file without written
|
|
* license agreement is strictly forbidden.
|
|
* In order to obtain a license, please contact us: simon@daig.re
|
|
* ...........................................................................
|
|
* INFORMATION SUR LA LICENCE D'UTILISATION
|
|
*
|
|
* L'utilisation de ce fichier source est soumise a une licence commerciale.
|
|
* Toute utilisation, reproduction, modification ou distribution du present
|
|
* fichier source sans contrat de licence ecrit est expressement interdite.
|
|
* Pour obtenir une licence, veuillez nous contacter a l'adresse: simon@daig.re
|
|
*
|
|
* @package La Poste Courrier suivi Tracking
|
|
* @author Agencya
|
|
* @copyright Copyright(c) 2015-2018
|
|
* @license See Readme.md
|
|
* Contact by Email : simon@daig.re
|
|
*/
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Class CsuiviTracking_Webservice
|
|
*/
|
|
class CsuiviTracking_Webservice
|
|
{
|
|
/**
|
|
* @param string $tracking
|
|
* @return mixed
|
|
*/
|
|
public static function getTracking($tracking)
|
|
{
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, 'https://api.laposte.fr/suivi/v1?code='.$tracking);
|
|
curl_setopt($ch, CURLOPT_HEADER, 0);
|
|
curl_setopt($ch, CURLOPT_USERAGENT, 'CsuiviTracking for Prestashop');
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Okapi-Key: '.(string)Configuration::get('CSUIVITRACKING_API_KEY')));
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
$res = curl_exec($ch);
|
|
return json_decode($res);
|
|
}
|
|
}
|