Created
November 20, 2013 05:46
-
-
Save matteosuppo/7558338 to your computer and use it in GitHub Desktop.
PHP integration with TNT (that doesn't work)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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