2009-02-17 13:14:53 +00:00
|
|
|
<?
|
|
|
|
|
|
|
|
ini_set('soap.wsdl_cache_enabled', 1);
|
|
|
|
|
|
|
|
class MTva {
|
|
|
|
|
2010-02-10 17:27:03 +00:00
|
|
|
public $vatNumber=''; // Numéro de TVA retourné
|
|
|
|
public $vatDefined=false; // Le numéro de TVA est il validé ?
|
|
|
|
public $errnum=0; // Numéro de l'erreur en cas d'erreur
|
2009-02-17 13:14:53 +00:00
|
|
|
public $errmsg=''; // Message de l'erreur en cas d'erreur
|
|
|
|
|
|
|
|
private $siren;
|
|
|
|
|
|
|
|
function __construct($siren) {
|
|
|
|
$this->siren=$siren;
|
|
|
|
$client = new SoapClient('http://ws.scores-decisions.com/entreprise/vat.wsdl',
|
|
|
|
array( 'trace' => 1, 'soap_version' => SOAP_1_1,
|
|
|
|
'login' => 'TESTTVA', 'password' => 'TVATESTPW'));
|
|
|
|
try {
|
|
|
|
$O = $client->getCompanyVat($this->siren);
|
|
|
|
if ($O->error->errnum) {
|
|
|
|
//echo 'Erreur : '. $O->error->errmsg .' ('. $O->error->errnum .")\n";
|
|
|
|
//echo $client->__getLastResponse()."\n";
|
|
|
|
$this->errnum=$O->error->errnum;
|
|
|
|
$this->errmsg=$O->error->errmsg;
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
$val=$O->result;
|
|
|
|
$this->vatNumber=$val->vatNumber;
|
|
|
|
$this->vatDefined=$val->vatDefined;
|
|
|
|
}
|
|
|
|
} catch (SoapFault $fault) {
|
2009-02-26 18:14:52 +00:00
|
|
|
include_once(realpath(dirname(__FILE__).'/../').'/soaperror.php');
|
|
|
|
processSoapFault($client,$fault,$tabInfo);
|
2009-02-17 13:14:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|