Skip to content

Instantly share code, notes, and snippets.

@matteosuppo
Created November 20, 2013 05:46
Show Gist options
  • Save matteosuppo/7558338 to your computer and use it in GitHub Desktop.
Save matteosuppo/7558338 to your computer and use it in GitHub Desktop.
PHP integration with TNT (that doesn't work)
$this->template = 'sale/xml/tnt_r.tpl';
$xml_ = $this->render(); // build the xml with the order data
try {
$gsearch = new SoapClient('https://www.mytnt.it/ResiService/ResiServiceImpl.wsdl');
$result = $gsearch->__soapCall('getPDFLabel', array(array('inputXml'=>$xml_)));
$result2 = $result->getPDFLabelReturn;
if ($result2->documentCorrect == 1 && strlen($result2->binaryDocument)>0){
// sparare il pdf $result2->binaryDocument;
header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="label.pdf"');
header('Expires: 0');
echo $result2->binaryDocument;
} else {
// sparare l'xml $result2->outputString;
header('Content-Type: text/txt');
header('Expires: 0');
echo $result2->outputString;
}
unset($gsearch);
} catch (SoapFault $e) {
header('Content-Type: text/html');
header('Expires: 0');
print_r($e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment