42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
|
<?
|
|||
|
|
|||
|
ini_set('soap.wsdl_cache_enabled', 1);
|
|||
|
|
|||
|
class MTva {
|
|||
|
|
|||
|
public $vatNumber=''; // Num<75>ro de TVA retourn<72>
|
|||
|
public $vatDefined=false; // Le num<75>ro de TVA est il valid<69> ?
|
|||
|
public $errnum=0; // Num<75>ro de l'erreur en cas d'erreur
|
|||
|
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) {
|
|||
|
//echo $client->__getLastResponse()."\n";
|
|||
|
//echo 'ERREUR SOAP :'.EOL;
|
|||
|
//print_r($fault);
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
?>
|