PHP SOAP Webservices samples - Download a file
Esta página aún no está disponible en tu idioma.
Download a file.
<?php // Register WSDL $OKMAuth = new SoapClient('http://localhost:8080/OpenKM/services/OKMAuth?wsdl'); $OKMDocument = new SoapClient('http://localhost:8080/OpenKM/services/OKMDocument?wsdl'); $OKMFolder = new SoapClient('http://localhost:8080/OpenKM/services/OKMFolder?wsdl'); // Login $loginResp = $OKMAuth->login(array('user' => 'okmAdmin', 'password' => 'admin')); $token = $loginResp->return;
// Open document test $docPath = '/okm:root/Customer Docs/foo/Invoice-0000034.pdf';
// Get document content $getDocumentResp = $OKMDocument->getContent(array('token' => $token, 'docId' => $docPath, 'checkout' => 0)); $length = strlen($getDocumentResp->return);
// Display document response as pdf header("Content-type: application/pdf"); header("Content-Length: $length"); header("Content-Disposition: inline; filename='test.pdf'"); echo $getDocumentResp->return;
// Logout $OKMAuth->logout(array('token' => $token));?>