extranet/www/pages_saisie/getIdentiteMandataire.php
2010-04-07 14:41:11 +00:00

42 lines
956 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)!=14 ) {
$output = array(
'Siret' => 'Siret incorrect',
);
echo json_encode($output);
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);
echo json_encode($tabEntrepD);
?>