File "print_awb.php"
Full path: /home/kosmetik/public_html/api/fan_courier/print_awb.php
File
size: 1.26 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
require_once __DIR__ . '/src/fanCourier.php';
require_once __DIR__ . '/src/Endpoint/printAwb.php';
use FanCourier\fanCourier;
function print_awb()
{
try {
$params = ['username' => $_GET['username'], 'user_pass' => $_GET['password'], 'client_id' => $_GET['id_client'], 'nr' => $_GET['awb_id']];
$fc = new fanCourier();
$endpoint = $fc->getEndpoint('printAwb');
$endpoint->setType('pdf');
$params['page'] = $_GET['format_awb'];
$params['type'] = '1';
$params['label'] = '1';
$endpoint->setParams($params);
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="AWB_FAN_' . $_GET['awb_id'] . '.pdf"');
header('Content-Description: File Transfer');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Content-Length: ' . strlen($endpoint->getResult()));
header('Pragma: public');
header('Accept-Ranges: bytes');
echo $endpoint->getResult();
} catch (Exception $exc) {
echo $exc->getMessage();
}
}
if ($_GET['awb_id'] != "" && $_GET['username'] != "" && $_GET['password'] != "" && $_GET['format_awb'] != "" && $_GET['id_client'] != "") {
print_awb();
} else {
echo 'Eroare';
}