* @copyright 2007-2019 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ include (dirname(__file__) . '/../../../../config/config.inc.php'); include (dirname(__file__) . '/../../../../init.php'); const CHARSET = 'UTF-8'; const REPLACE_FLAGS = ENT_COMPAT; $geistoken = Tools::getValue('geistoken'); if ($geistoken == 'GeisLogistic') { $apicode = Configuration::get('GEISLOGISTIC_CODE'); // CustomerCode $apikey = Configuration::get('GEISLOGISTIC_API'); //Password $format = Configuration::get('GEISLOGISTIC_FORMAT'); if($format == '3' || $format == '4') {$resolution = Configuration::get('GEISLOGISTIC_RESOLUTION');}else{$resolution = '';} $trackingnumber = Tools::getValue('trackingnumber'); $testmode = Configuration::get('GEISLOGISTIC_TEST'); $country = Configuration::get('GEISLOGISTIC_COUNTRY'); if ($testmode == '0') { if ($country == 'PL') { $wsdl = 'https://gclient.geis.pl/GService/GService.svc?wsdl'; }else{ $wsdl = 'https://gclient.geis.cz/GService/GService.svc?wsdl'; } }else{ if ($country == 'PL') { $wsdl = 'https://gclient.geis.pl/GServiceTest/GService.svc?wsdl'; }else{ $wsdl = 'https://gclient.geis.cz/GServiceTest/GService.svc?wsdl'; } } ini_set("soap.wsdl_cache_enabled", "0"); try { $client = new SoapClient($wsdl, array("trace" => 1)); $data['Request']['Header'] = array( 'CustomerCode' => $apicode, 'Language' => $country, 'Password' => $apikey, ); $data['Request']['RequestObject'] = array( 'DistributionChannel' => Configuration::get('GEISLOGISTIC_CHANNEL'), 'Format' => $format, 'Position' => '1', 'Resolution' => $resolution, ); $data['Request']['RequestObject']['ShipmentNumbers']['LabelItem']['ShipmentNumber'] = $trackingnumber; $result = $client->GetLabel($data); } catch (exception $ex) { print "BLAD: .$ex->faultcode .$ex->faultstring. \n\n"; } if ($result->GetLabelResult->ErrorCode != '0000' ){ print_r($result->GetLabelResult->ErrorMessage); }else{ $nr = $result->GetLabelResult->ResponseObject->LabelData->LabelItemData->Data; header('Content-type: application/pdf'); if($format == '1' || $format == '5') { header('Content-Disposition: attachment; filename="etykieta.pdf"'); } if($format == '2') { header('Content-Disposition: attachment; filename="etykieta.epl"'); } if($format == '3') { header('Content-Disposition: attachment; filename="etykieta.zpl"'); } if($format == '4') { header('Content-Disposition: attachment; filename="etykieta.bmp"'); } header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); print_r($nr); } $url = htmlspecialchars($_SERVER['HTTP_REFERER']); print "\n\n Powrót"; }else{ die(); }