getInvoice($key); if(isset($return[0]['number_invoice'])) { /* Call webservice - curl */ $c = curl_init(); curl_setopt($c, CURLOPT_URL, Configuration::get('OSI_WS_URL').'?service_id='.Configuration::get('OSI_SERVICE_CODE').'&action=get_facture&facture_ref='.$return[0]['number_invoice'].'.pdf'); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_HEADERFUNCTION, "readHeader"); curl_setopt($c, CURLOPT_USERPWD, Configuration::get('OSI_WS_LOGIN').':'.Configuration::get('OSI_WS_PASSWD')); $output = curl_exec($c); if($output === false) { trigger_error("Erreur curl : ".curl_error($c), E_USER_WARNING); } else { header('Content-type: application/pdf'); header('Content-Disposition: attachement; filename=facture_'.$return[0]['number_invoice'].'.pdf'); echo $output; } curl_close($c); } else { /* 404 Error */ echo "