52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
require_once realpath(dirname(__FILE__)).'/functions.php';
|
|
require_once realpath(dirname(__FILE__)).'/Types.php';
|
|
|
|
define ('WEBSERVICE_URL','http://78.31.45.206/ws2/');
|
|
define ('WEBSERVICE_URI','http://78.31.45.206/');
|
|
|
|
class WsEntreprise {
|
|
|
|
/**
|
|
* Retourne les informations identitaires de l'entreprise ou de l'établissement demandé
|
|
* @param string $siret
|
|
* @param integer $id
|
|
* @param boolean $forceVerif
|
|
* @return IdentiteReturnType
|
|
*/
|
|
function getIdentite($siret, $id = 0, $forceVerif = false) {
|
|
|
|
// test authentification, récupération des données d'authentification
|
|
//$_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $_SERVER['REMOTE_ADDR']
|
|
|
|
$client = new SoapClient( null,
|
|
array( 'trace' => 1,
|
|
'soap_version' => SOAP_1_1,
|
|
'location' => WEBSERVICE_URL,
|
|
'uri' => WEBSERVICE_URI,
|
|
'login' => $_SERVER['PHP_AUTH_USER'],
|
|
'password' => $_SERVER['PHP_AUTH_PW']
|
|
));
|
|
|
|
try {
|
|
$O = $client->getIdentite($siret, $idEntreprise, $forceVerif);
|
|
} catch (SoapFault $fault) {
|
|
file_put_contents('error.txt', 'error');
|
|
}
|
|
$error = new ErrorType();
|
|
$error = array_to_object($O['error']);
|
|
|
|
$result = new IdentiteResultType();
|
|
$result = array_to_object($O['result']);
|
|
|
|
$outputParams = new IdentiteReturnType();
|
|
$outputParams->error = $error;
|
|
$outputParams->result = $result;
|
|
return $outputParams;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|