63 lines
2.4 KiB
PHP
63 lines
2.4 KiB
PHP
<?php
|
|
|
|
function infogreffeProduits($siren, $type){
|
|
$client2 = new SoapClient(null, array(
|
|
'location' => INFOGREFFE_WS_URL,
|
|
'uri' => INFOGREFFE_WS_URI,
|
|
'soap_version' => SOAP_1_1,
|
|
'trace' => 1,
|
|
'style' => SOAP_RPC,
|
|
'use' => SOAP_ENCODED,
|
|
'encoding' => 'utf-8'
|
|
));
|
|
$req = '<demande>'.
|
|
'<emetteur>'.
|
|
'<code_abonne>'.INFOGREFFE_WS_USER.'</code_abonne>'.//85009006
|
|
'<mot_passe>'.INFOGREFFE_WS_PASS.'</mot_passe>'.//
|
|
'<reference_client>'.INFOGREFFE_WS_REF.'</reference_client>'.
|
|
'<code_requete>'.
|
|
'<type_profil>A</type_profil>'.
|
|
'<origine_emetteur>IC</origine_emetteur>'.
|
|
'<nature_requete>C</nature_requete>'.
|
|
'<type_document>'.$type.'</type_document>'.// KB=Kbis, HQ=Histo, ST=Statut, AC=Acte, LE=Liste étab
|
|
'<type_requete>S</type_requete>'.
|
|
'<media>WS</media>'.
|
|
'<mode_diffusion>'.
|
|
'<mode type="T"/>'.
|
|
'</mode_diffusion>'.
|
|
'</code_requete>'.
|
|
'</emetteur>'.
|
|
'<commande>'.
|
|
'<num_siren>'.$siren.'</num_siren>'.
|
|
'</commande></demande>';
|
|
$req = utf8_encode($req);
|
|
try {
|
|
$O = $client2->getProduitsWebServicesXML($req);
|
|
$xml = implode('', (array)$O);
|
|
}catch (SoapFault $soapFault) {
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
$success = false;
|
|
$response = $client2->__getLastResponse();
|
|
$response = str_replace("<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'><SOAP-ENV:Body><ns0:getProduitsWebServicesXMLResponse xmlns:ns0='urn:local' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return xsi:type='xsd:string'>",'', $response);
|
|
$xml = str_replace('</return></ns0:getProduitsWebServicesXMLResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>','', $response);
|
|
}
|
|
return $xml;
|
|
}
|
|
|
|
function getKbis($siren){
|
|
global $client;
|
|
//ini_set('default_socket_timeout', 120); //timeout 2 min
|
|
$return = FALSE;
|
|
try {
|
|
$O = $client->getKbis($siren, 1,0);
|
|
$kbis = $O['result'];
|
|
$return = $kbis['Url'];
|
|
} catch (SoapFault $fault) {
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$_SESSION['tabInfo']);
|
|
}
|
|
return $return;
|
|
}
|
|
|