38 lines
927 B
PHP
38 lines
927 B
PHP
<?php
|
|
|
|
function htmlentitydecode_deep($value)
|
|
{
|
|
$value = is_array($value) ?
|
|
array_map('htmlentitydecode_deep', $value) :
|
|
html_entity_decode($value);
|
|
|
|
return $value;
|
|
}
|
|
|
|
$siren = isset($_REQUEST['siren'])? trim($_REQUEST['siren']) : '';
|
|
$siren = str_replace(' ','',$siren); //Remplacer les espaces
|
|
|
|
if ( $siren=='' || strlen($siren)<9 || strlen($siren)>9 ) exit;
|
|
|
|
$client = new SoapClient(null, array(
|
|
'trace' => 1,
|
|
'soap_version' => SOAP_1_1,
|
|
'location' => WEBSERVICE_URL,
|
|
'uri' => WEBSERVICE_URI,
|
|
'login' => $_SESSION['tabInfo']['login'],
|
|
'password' => $_SESSION['tabInfo']['password'],
|
|
));
|
|
|
|
$tabEntrep=array();
|
|
try {
|
|
$O = $client->getIdentite($siren);
|
|
$tabEntrep=$O['result'];
|
|
|
|
} catch (SoapFault $fault) {}
|
|
|
|
//Retourner le tableau sous forme json
|
|
$tabEntrepD = htmlentitydecode_deep($tabEntrep);
|
|
$firephp->log($tabEntrepD, 'result');
|
|
echo json_encode($tabEntrepD);
|
|
|
|
?>
|