Suppression fichier php
This commit is contained in:
parent
c8a42d2a8a
commit
d87ebbfbdb
@ -1,456 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
define('HOST_INSEE', 'avis-situation-sirene.insee.fr');
|
||||
define('SITE_INSEE', 'http://'. HOST_INSEE .'/');
|
||||
|
||||
class Metier_Insee_MSirene
|
||||
{
|
||||
private $response1;
|
||||
|
||||
function __construct() {
|
||||
|
||||
/** Etape de connexion au site de l'INSEE pour simuler correctement un utilisateur WEB
|
||||
**/
|
||||
$this->response1=getUrl(SITE_INSEE,'','','',false,HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'SIRENET_Script/Accueil/script_page_accueil.asp',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle',false, HOST_INSEE);
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle',false, HOST_INSEE);
|
||||
//sleep(1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les informations relatives à un établissement et son entreprise (par défaut le siège si pas de NIC)
|
||||
*
|
||||
* @param unknown_type $sirenLu
|
||||
* @param unknown_type $nicLu
|
||||
*/
|
||||
function getInfoEtab($sirenLu, $nicLu='') //if ($argv[1]=='id' || $argv[1]=='pj')
|
||||
{
|
||||
$tabRet=array();
|
||||
|
||||
/** Paramètre de requête "option" à l'insee :
|
||||
** 1: Fiche du siège + Données entreprises
|
||||
** 2: Tous les établissements de l'entreprise
|
||||
** 3: Un établissement particulier
|
||||
** 4: Département
|
||||
**/
|
||||
if ($nicLu<>'') $option=3;
|
||||
else $option=1;
|
||||
|
||||
// Requête d'interrogation
|
||||
$postData=array('siren'=>$sirenLu,
|
||||
'option'=>$option,
|
||||
'nic'=>$nicLu,
|
||||
'dep'=>'',
|
||||
'listeDep'=>'');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $this->response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle',false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=nouveau', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false',false,HOST_INSEE);
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
//$libelleErreur='Erreur INSEE inconnue 1';
|
||||
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false',false,HOST_INSEE);
|
||||
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur',false,HOST_INSEE);
|
||||
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
|
||||
if ($pos>0){
|
||||
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
|
||||
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
|
||||
} else
|
||||
$tabRet['erreur']='Erreur INSEE inconnue';
|
||||
}
|
||||
else
|
||||
{ if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege')
|
||||
// L'établissement demandé est un siège !
|
||||
$option=1;
|
||||
|
||||
if ($option==3)
|
||||
{
|
||||
// On déroule les URLs d'appels établissement
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false',false,HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement',false,HOST_INSEE);
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement',false,HOST_INSEE);
|
||||
$responseEtab=$responseEtab['body'];
|
||||
// On recherche si on est bien sur un fiche établissement
|
||||
$pos=strpos($responseEtab, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
|
||||
if ($pos<1)
|
||||
$tabRet['erreur']='Erreur SCRIPT Fiche Etablissement non trouvée';
|
||||
$responseSiege=$responseEtab;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On déroule les URLs d'appels Sièges
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false',false,HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau sièges
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege',false,HOST_INSEE);
|
||||
$responseSiege=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege',false,HOST_INSEE);
|
||||
$responseSiege=$responseSiege['body'];//strip_tags(html_entity_decode(), '<td>');
|
||||
// On recherche si on est bien sur un fiche siège
|
||||
$pos=strpos($responseSiege, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
|
||||
if ($pos<1)
|
||||
$tabRet['erreur']='Erreur SCRIPT Fiche Siège non trouvée';
|
||||
}
|
||||
|
||||
// Niveau entreprise
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege',false,HOST_INSEE);
|
||||
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=entreprise',false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail',false,HOST_INSEE);
|
||||
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', false,HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail',false,HOST_INSEE);
|
||||
$responseEntreprise=$responseEntreprise['body'];
|
||||
$pos=strpos($responseEntreprise, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Entreprise</B>');
|
||||
if ($pos<1) {
|
||||
$tabRet['erreur']='Erreur SCRIPT Fiche Entreprise non trouvée';
|
||||
}
|
||||
|
||||
/** Recherche des données établissement
|
||||
**/
|
||||
$tabRet['etablissement']=$this->getDataEtablissement($responseSiege);
|
||||
|
||||
/** Recherche des données entreprise
|
||||
**/
|
||||
$tabRet['entreprise']=$this->getDataEntreprise($responseEntreprise);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère la liste de tous les établissements d'une entreprise
|
||||
*
|
||||
* @param unknown_type $sirenLu
|
||||
*/
|
||||
function getListeEtabs($sirenLu)
|
||||
{
|
||||
// Requête d'interrogation
|
||||
$postData=array('siren'=>$sirenLu,
|
||||
'option'=>2,
|
||||
'nic'=>'',
|
||||
'dep'=>'',
|
||||
'listeDep'=>'');
|
||||
|
||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $this->response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle', false, HOST_INSEE);
|
||||
$action='nouveau';
|
||||
$referer=SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false';
|
||||
$nbRepTot=$pageCour=$nbTotPage=$nbRepParPage=$numEtab=0;
|
||||
$tabInfoEtab=array();
|
||||
$tabRet=array();
|
||||
|
||||
while(true)
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action='.$action, $this->response1["header"]["Set-Cookie"], '', $referer, false, HOST_INSEE);
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
//$libelleErreur='Erreur INSEE inconnue 1';
|
||||
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
|
||||
{
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', false, HOST_INSEE);
|
||||
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', false, HOST_INSEE);
|
||||
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
|
||||
if ($pos>0){
|
||||
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
|
||||
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
|
||||
} else
|
||||
$libelleErreur='Erreur INSEE inconnue';
|
||||
}
|
||||
|
||||
// On déroule les URLs d'appels liste des établissements
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', false, HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseListe=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_bas.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', false, HOST_INSEE);
|
||||
$responseListe=$responseListe['body'];
|
||||
|
||||
$pos=strpos($responseListe, 'Nombre total de réponses : '."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, '</b></font>', $pos+73);
|
||||
$nbRepTot=trim(substr($responseListe, $pos+73, $posFin-($pos+73)));
|
||||
}
|
||||
$pos=strpos($responseListe, ' - Affichage de la page '."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, ' - </b></font>', $pos+75);
|
||||
$strPages=trim(substr($responseListe, $pos+75, $posFin-($pos+75)));
|
||||
$tabPages=explode(' / ', $strPages);
|
||||
$pageCour=$tabPages[0];
|
||||
$nbTotPage=$tabPages[1];
|
||||
}
|
||||
$pos=strpos($responseListe, ' - </b></font>'."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseListe, '</b></font>', $pos+60);
|
||||
$nbRepParPage=trim(substr($responseListe, $pos+60, $posFin-($pos+60)));
|
||||
}
|
||||
|
||||
/* TODO = Récupérer les infos étab + entrep pour chaque ligne du tableau !!!*
|
||||
*/
|
||||
if ($libelleErreur=='Erreur SCRIPT Inconnue')
|
||||
$libelleErreur='';
|
||||
for ($i=1;$i<11; $i++)
|
||||
{
|
||||
if ($numEtab==$nbRepTot)
|
||||
break; // Il n'y a pas plus d'établissement à récupérer ! On sort...
|
||||
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=detail&numtableau='.$i, $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp', false, HOST_INSEE);
|
||||
if ($responseQ['code']==302)
|
||||
{
|
||||
// Siren Invalide ou autre erreur non répertoriée !
|
||||
$header=$responseQ['header'];
|
||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i)
|
||||
{
|
||||
// On déroule les URLs d'appels fiche siège
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege&numtableau='.$i, $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', false, HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', false, HOST_INSEE);
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseEtab=$responseEtab['body'];
|
||||
|
||||
// Récupération de la fiche entreprise INSEE
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseEntreprise=$responseEntreprise['body'];
|
||||
}
|
||||
elseif (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i)
|
||||
{
|
||||
// On déroule les URLs d'appels établissement
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement&numtableau='.$i, $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', false, HOST_INSEE);
|
||||
//sleep(1);
|
||||
// Frames réponse niveau Etab
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', false, HOST_INSEE);
|
||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $this->response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i, false, HOST_INSEE);
|
||||
$responseEtab=$responseEtab['body'];
|
||||
}
|
||||
$tabRet['etablissements'][$numEtab]=$this->getDataEtablissement($responseEtab);
|
||||
$tabRet['entreprise']=$this->getDataEntreprise($responseEntreprise);
|
||||
|
||||
if ($libelleErreur<>'' && $tabInfoEtab['siret'] =='') $siret=$sirenLu . $nicLu;
|
||||
else $siret=$tabInfoEtab['siret'];
|
||||
|
||||
/*$str= date('d/m/Y à H:i:s') .';'.
|
||||
$libelleErreur .';'.
|
||||
// Siège
|
||||
$siret .';'.
|
||||
$tabInfoEtab['active'] .';'.
|
||||
$tabInfoEtab['dateAbsActivite'] .';'.
|
||||
$tabInfoEtab['typeEtablissement'] .';'.
|
||||
$tabInfoEtab['dateMAJ'] .';'.
|
||||
$tabInfoEtab['dateCreation'] .';'.
|
||||
$tabInfoEtab['raisonSociale'] .';'.
|
||||
$tabInfoEtab['Enseigne'] .';'.
|
||||
$tabInfoEtab['NafCode'] .';'.
|
||||
$tabInfoEtab['NafLib'] .';'.
|
||||
$tabInfoEtab['AdresseLigne1'] .';'.
|
||||
$tabInfoEtab['AdresseLigne2'] .';'.
|
||||
$tabInfoEtab['AdresseLigne3'] .';'.
|
||||
$tabInfoEtab['etatJuridique'] .';'.
|
||||
$tabInfoEtab['dateEtatJuridique'] .';'.
|
||||
// Entreprise
|
||||
$tabInfoEntrep['dateCreationEntrep'] .';'.
|
||||
$tabInfoEntrep['raisonSocialeEntrep'] .';'.
|
||||
$tabInfoEntrep['sigle'] .';'.
|
||||
$tabInfoEntrep['NafCodeEntrep'] .';'.
|
||||
$tabInfoEntrep['NafLibEntrep'] .';'.
|
||||
$tabInfoEntrep['FJCodeEntrep'] .';'.
|
||||
$tabInfoEntrep['FJLibEntrep'] .';'.
|
||||
$tabInfoEntrep['nbEtabActifs'] .';';
|
||||
*/
|
||||
//fwrite($fpOUT, $str."\r\n");
|
||||
$numEtab++;
|
||||
$num=$key+1;
|
||||
$typeEtablissement=$tabInfoEtab['typeEtablissement'];
|
||||
//echo "Question $num/$nbLignes : Demande=$sirenLu$nicLu Etablissement $numEtab/$nbRepTot $typeEtablissement=$siret $libelleErreur\r\n";
|
||||
flush();
|
||||
sleep(1);
|
||||
|
||||
}//end for
|
||||
}//end if
|
||||
if ($pageCour==$nbTotPage) {
|
||||
// On sort de la boucle de passage à la page de liste suivante car il n'y a plus d'autres pages
|
||||
break;
|
||||
} else {
|
||||
$action='listeplus';
|
||||
$referer=SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp';
|
||||
}
|
||||
}
|
||||
} //Fin While
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
private function getDataEtablissement($pageHtml)
|
||||
{
|
||||
global $libelleErreur;
|
||||
|
||||
$responseSiege=$pageHtml;
|
||||
$tabRet=array();
|
||||
|
||||
// On recherche si on est sur un établissement siège ou secondaire
|
||||
$pos=strpos($pageHtml, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
|
||||
if ($pos>0)
|
||||
$tabRet['typeEtablissement']='secondaire';
|
||||
|
||||
$pos=strpos($pageHtml, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
|
||||
if ($pos>0)
|
||||
$tabRet['typeEtablissement']='siège';
|
||||
|
||||
// Recherche Dernière MAJ / Activité
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">(dernière mise à jour :');
|
||||
if ($pos>0) {
|
||||
$tabRet['dateMAJ']=substr($responseSiege, $pos+51, 10);
|
||||
$tabRet['dateAbsActivite']='';
|
||||
$tabRet['active']='O';
|
||||
} else {
|
||||
$tabRet['active']='N';
|
||||
$tabRet['dateMAJ']='';
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence d\'activité notée le : ');
|
||||
if ($pos>0) $tabRet['dateAbsActivite']=substr($responseSiege, $pos+78, 10);
|
||||
else {
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence d\'activité');
|
||||
if ($pos>0) $tabRet['dateAbsActivite']='';
|
||||
}
|
||||
}
|
||||
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>n° SIRET :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
||||
$tabRet['siret']=str_replace(' ', '', html_entity_decode(substr($responseSiege, $pos+97, 32)));
|
||||
|
||||
$pos=strpos($responseSiege, 'size="-1"> <B>Date de création :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseSiege, '</font>', $pos+109);
|
||||
$tabRet['dateCreation']=str_replace(' ', '', html_entity_decode(substr($responseSiege, $pos+109, $posFin-($pos+109))));
|
||||
}
|
||||
else $tabRet['dateCreation']='';
|
||||
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$len=127;
|
||||
if ($pos==0){
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$len=122;
|
||||
if ($pos==0){
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$len=126;
|
||||
$libelleErreur='Informations INSEE non diffusables';
|
||||
}
|
||||
}
|
||||
if ($libelleErreur=='') {
|
||||
//LARGE*DOMINIQUE MICHEL/ <BR>GERANT SARL BIMAGIQUE </font>
|
||||
$posFin=strpos($responseSiege, '</font>', $pos+$len);
|
||||
$raisonSocialeStr=trim(substr($responseSiege, $pos+$len, $posFin-($pos+$len)));
|
||||
$raisonSocialeTabLigne=explode('<BR>', $raisonSocialeStr);
|
||||
$tabRet['raisonSociale']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[0])));
|
||||
$tabRet['Enseigne']=trim(str_replace(' ', '', html_entity_decode(@$raisonSocialeTabLigne[1])));
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Activité principale :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$tabRet['NafCode']=substr($responseSiege, $pos+120, 4);
|
||||
$tabRet['NafLib']=trim(substr($responseSiege, $pos+137, 70));
|
||||
|
||||
$pos=strpos($responseSiege, ' size="-1"> <B>Adresse :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$posFin=strpos($responseSiege, '</font>', $pos+103);
|
||||
$AdresseStr=substr($responseSiege, $pos+103, $posFin-($pos+103));
|
||||
$AdresseTabLigne=explode('<BR>', $AdresseStr);//'
|
||||
$tabRet['AdresseLigne1']=str_replace(' ', '/', $AdresseTabLigne[0]);
|
||||
$tabRet['AdresseLigne2']=str_replace(' ', '/', $AdresseTabLigne[1]);
|
||||
$tabRet['AdresseLigne3']=str_replace(' ', '/', $AdresseTabLigne[2]);
|
||||
/*
|
||||
$AdresseNum=$AdresseTabLigne1[0];
|
||||
$AdresseVoi=$AdresseTabLigne1[1];
|
||||
$AdresseRue=$AdresseTabLigne1[2];
|
||||
$AdresseCP=$AdresseTabLigne2[0];
|
||||
$AdresseVille=$AdresseTabLigne2[1];
|
||||
*/
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="-1"><b>L\'entreprise est connue au répertoire comme ');
|
||||
if ($pos>0) {
|
||||
$posFin=strpos($responseSiege, '</b>', $pos+106);
|
||||
$tabRet['etatJuridique']=html_entity_decode(substr($responseSiege, $pos+106, $posFin-($pos+106)));
|
||||
$tabRet['dateEtatJuridique']='';
|
||||
} else {
|
||||
$pos=strpos($responseSiege, '<font face="Arial" size="-1"><b>L\'entreprise est cessée le : ');
|
||||
$tabRet['dateEtatJuridique']=substr($responseSiege, $pos+86, 10);
|
||||
$tabRet['etatJuridique']='cessée';
|
||||
}
|
||||
//echo 'GetDataEtab="'.$libelleErreur."\"\r\n";
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function getDataEntreprise($pageHtml)
|
||||
{
|
||||
global $libelleErreur;
|
||||
|
||||
$responseEntreprise=$pageHtml;
|
||||
$tabRet=array();
|
||||
|
||||
if ($libelleErreur=='') {
|
||||
|
||||
$pos=strpos($responseEntreprise, 'size="-1"> <B>Date de création :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
||||
if ($pos>0)
|
||||
$tabRet['dateCreationEntrep']=substr($responseEntreprise, $pos+109, 10);
|
||||
else
|
||||
$tabRet['$dateCreationEntrep']='';
|
||||
|
||||
// Raison sociale et Sigle
|
||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Raison sociale et Sigle :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$posFin=strpos($responseEntreprise, '</font>', $pos+123);
|
||||
$raisonSocialeStr=trim(substr($responseEntreprise, $pos+123, $posFin-($pos+123)));
|
||||
$raisonSocialeTabLigne=explode('<BR>', $raisonSocialeStr);
|
||||
$tabRet['raisonSocialeEntrep']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[0])));
|
||||
$tabRet['sigle']=trim(str_replace(' ', '', html_entity_decode(@$raisonSocialeTabLigne[1])));
|
||||
|
||||
// Activité prinicpale Entrep
|
||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Activité principale :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$tabRet['NafCodeEntrep']=substr($responseEntreprise, $pos+120, 4);
|
||||
$tabRet['NafLibEntrep']=trim(substr($responseEntreprise, $pos+137, 70));
|
||||
|
||||
// Forme Juridique
|
||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Forme juridique :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
||||
$tabRet['FJCodeEntrep']=substr($responseEntreprise, $pos+116, 4);
|
||||
$tabRet['FJLibEntrep']=trim(substr($responseEntreprise, $pos+133, 70));
|
||||
|
||||
// Nb Etab Actifs
|
||||
$tabRet['nbEtabActifs']=trim(str_replace(' ', '', html_entity_decode(@getTextInHtml($responseEntreprise, '<B>Nb établissements actifs :</B>', '<font face="Arial" size="-1">', '</font>'))));
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
@ -1,354 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
class Metier_Partenaires_MGlobal {
|
||||
|
||||
function __construct($siren) {
|
||||
|
||||
$timeout=5;
|
||||
|
||||
$c_cof = curl_init();
|
||||
$c_soc = curl_init();
|
||||
$c_pou = curl_init();
|
||||
|
||||
// Définit l'URL ainsi que d'autres options
|
||||
curl_setopt($c_cof, CURLOPT_URL, 'http://www.cofacerating.fr/portail/entreprise_identite/identite.asp?ip=pagespro&lg=fr&nsiren='.$siren);
|
||||
curl_setopt($c_cof, CURLOPT_HEADER, 0);
|
||||
curl_setopt($c_cof, CURLOPT_TIMEOUT, $timeout);
|
||||
curl_setopt($c_cof, CURLOPT_REFERER, '');
|
||||
|
||||
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
|
||||
curl_setopt($ch2, CURLOPT_HEADER, 0);
|
||||
|
||||
// Création du gestionnaire multiple
|
||||
$mh = curl_multi_init();
|
||||
|
||||
// Ajoute les deux gestionnaires
|
||||
curl_multi_add_handle($mh,$ch1);
|
||||
curl_multi_add_handle($mh,$ch2);
|
||||
|
||||
$running=null;
|
||||
// Exécute le gestionnaire
|
||||
do {
|
||||
curl_multi_exec($mh,$running);
|
||||
} while($running > 0);
|
||||
|
||||
// Ferme tous les gestionnaires
|
||||
curl_multi_remove_handle($ch1);
|
||||
curl_multi_remove_handle($ch2);
|
||||
curl_multi_close($mh);
|
||||
|
||||
|
||||
$referer='';
|
||||
$url='http://www.cofacerating.fr/portail/entreprise_identite/identite.asp?ip=pagespro&lg=fr&nsiren='.$siren;
|
||||
$page=getUrl($url, '', '', $referer, false, 'www.cofacerating.fr', '', 10);
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
$this->nscrl=@getTextInHtml($this->body, '&nscrl=', '=','&');
|
||||
$this->rSocAdrCPVille=trim(str_replace(chr(160), ' ', html_entity_decode(utf8_encode(@getTextInHtml($this->body, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne"> <b> Raison sociale<br>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><b>','</tr>')))));
|
||||
$tmp=explode('<br>', $this->rSocAdrCPVille);
|
||||
$this->raisonSociale=trim($tmp[0]);
|
||||
unset($tmp[0]);
|
||||
$this->adresse=trim(strip_tags(implode(',', $tmp)));
|
||||
$this->tel=trim(@getTextInHtml($this->body, '<td bgcolor="#F3E5CC" class="tabligne"><b>Téléphone<br>', '<td bgcolor="#FFF3DE" class="tabval" valign="top">', '<br>'));
|
||||
$this->fax=trim(@getTextInHtml($this->body, 'Télécopie</b></td>', '<br>', '</td>'));
|
||||
$this->web=trim(@getTextInHtml($this->body, '<td bgcolor="#F3E5CC" class="tabligne"><b>Adresse internet <br>', ' class="tabval"><a class="tabval" HREF="', '" target="_new">'));
|
||||
$this->mail=trim(@getTextInHtml($this->body, '<a class="tabval" href="mailto:', ':', '">'));
|
||||
|
||||
$bourse=trim(@getTextInHtml($this->body, 'Ville Bourse</b></td>', 'class="tabval">', '</td>'));
|
||||
$tmp=explode('<br>', $bourse);
|
||||
$this->bourseIsin=trim($tmp[0]);
|
||||
$this->bourseMarche=trim($tmp[1]);
|
||||
$this->bourseVille=trim($tmp[2]);
|
||||
|
||||
$infosDispo=trim(@getTextInHtml($this->body, '<b>Liste Produits</b><br></td>', '<br></td><td class="menu3"><img src="../images/vide.gif" border="0"><br></td><td colspan="2" class="menu3">', 'Un secteur ou une région en France</a><br></td>'));
|
||||
$tabTmp=explode('<a href="', $infosDispo);
|
||||
foreach ($tabTmp as $k=>$lien) {
|
||||
preg_match('/^(.*)">(.*)<\/a>/i', $lien, $matches);
|
||||
if ($matches[2]<>'') $this->tabInfos[$matches[2]]=$matches[1];
|
||||
if (substr($matches[2], 0, 12)=='rapport éco.') $this->infoEco='http://www.cofacerating.fr/portail/entreprise_identite/'.$matches[1];//ip=pagespro&
|
||||
elseif (substr($matches[2], 0, 6)=='bilan ') $this->tabBilans[]=substr($matches[2], 6,strlen($matches[2])-6);
|
||||
}
|
||||
$this->activite=trim(str_replace(chr(160), ' ', html_entity_decode(utf8_encode(@getTextInHtml($this->body, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne" valign="top"><b>Libellé code activité </b></td>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval">', '</td>')))));
|
||||
$this->naf=trim(@getTextInHtml($this->body, '<a href="../chaineeco_dynaeco/DynaEco.asp?cnaf=', 'cnaf=', '&'));
|
||||
|
||||
/**
|
||||
** Recherche du NIC sur Société .com
|
||||
**/
|
||||
|
||||
/*
|
||||
$refererS='http://www.societe.com/';
|
||||
$urlS='http://www.societe.com/cgi-bin/recherche?rncs='.$siren.'&vu=1';
|
||||
$page=getUrl($urlS, '', '', $refererS, false, 'www.societe.com');
|
||||
$ste=$page['body'];
|
||||
$this->nic=trim(@getTextInHtml($ste, 'SIRET</div><div class="ficheAltCol2 size11">', $siren, '</div>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<b><span class="size10">RCS', 'RCS ', ' '.substr($siren,0,3)));
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->rcsVille=$tabTmp[0];//<td class="txtBlanc" align="left"><b><span class="size10">RCS Paris B 552 144 503<br></span></b></td>
|
||||
$this->rcsType=$tabTmp[1];
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Code activité</div>', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$tabTmp=explode(' - ', $strTmp);
|
||||
$this->naf=$tabTmp[0];
|
||||
$this->nafLib=$tabTmp[1];
|
||||
|
||||
// <div class="ficheAltCol1 size11">Siège social</div><div class="ficheAltCol2 size11">75 Avenue la Grande Armee - 75116 PARIS 16</div>
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Capital social', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$this->capitalType='social';
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->capitalMontant=str_replace(',', '.', str_replace('.', '', $tabTmp[0]));
|
||||
$this->capitalDevise =$tabTmp[1];
|
||||
|
||||
$this->fj=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Forme juridique', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
$this->nationalite=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11">Nationalité</div>', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($ste, ' DIRIGEANT(S) </span></span></div>', '<div class="ficheCadre" style="min-height:85px;">', '<div class="spacer"></div>'));
|
||||
$tabTmp=explode('<div class="h1bleu2"></div>', $strTmp);
|
||||
foreach ($tabTmp as $k=>$dir) {
|
||||
if (trim($dir)=='') break;
|
||||
$tabTmp1=explode('</div><div class="ficheAltCol2 size11">', $dir);
|
||||
$tabTmp2=explode('représenté par', $tabTmp1[1]);
|
||||
if (isset($tabTmp2[1]) && $tabTmp2[1]<>'') {
|
||||
$soc=trim($tabTmp2[0]);
|
||||
$diri=trim($tabTmp2[1]);
|
||||
} else {
|
||||
$soc='';
|
||||
$diri=trim($tabTmp1[1]);
|
||||
}
|
||||
preg_match("/^(Mme|M\.|Mlle|Mle|M) ([A-Z\s]*) ([A-Z][a-z\s]*)/", $diri, $matches);
|
||||
//print_r($matches);
|
||||
$this->tabDirigeants[]=array('FONCTION'=>trim(strip_tags($tabTmp1[0])), 'SOCIETE'=>$soc, 'GENRE'=>$matches[1], 'PRENOM'=>trim($matches[3]), 'NOM'=>trim($matches[2]));
|
||||
}
|
||||
|
||||
$this->dateImmatriculation=trim(@getTextInHtml($ste, '<div class="ficheAltCol1 size11"> Immatriculation', '<div class="ficheAltCol2 size11">', '</div>'));
|
||||
//06-03-2007</div>
|
||||
/* Date Creation = ""
|
||||
En bourse = ""
|
||||
Effectif societe = ""
|
||||
Dirigeants :
|
||||
**/
|
||||
$urlRacine='http://infobilan.decideur.com/';
|
||||
$tabPost=array( 'choix'=>'1',
|
||||
'pagePrecedente'=>'recherche_entreprise.html',
|
||||
'nomsocRech'=>'',
|
||||
'cpRech'=>'',
|
||||
'villeRech'=>'',
|
||||
'nomdirRech'=>'',
|
||||
'predirRech'=>'',
|
||||
'sirenRech'=>$siren,
|
||||
'telRech'=>'',
|
||||
'Rechercher.x'=>round(79),
|
||||
'Rechercher.y'=>round(19),);
|
||||
$url=$urlRacine.'liste_result.html';
|
||||
$referer=$urlRacine.'recherche_entreprise.html';
|
||||
$page=getUrl($url,'', $tabPost, $referer, false, 'infobilan.decideur.com');
|
||||
$this->body=$page['body'];
|
||||
$strCookie=$page['header']['Set-Cookie'];
|
||||
$refererInfoD=$url;
|
||||
|
||||
if(preg_match_all('/<a href="choix_pdt\.html\?(.*)" class="tt1">(.*)<\/a><\/span><br>/i', $page['body'], $matches))
|
||||
$urlInfoD=$urlRacine.'choix_pdt.html?'.$matches[1][0];
|
||||
else
|
||||
$urlInfoD='';
|
||||
|
||||
$page=getUrl($this->infoEco, '', '', $url, false, 'www.cofacerating.fr');
|
||||
if (strpos($page['body'], '<b>Choix du mode de paiement</b>')===false) { // Le rapport éco. est cadeau !!!
|
||||
$this->infoEco=true;
|
||||
$eco=$page['body'];
|
||||
//die ($eco);
|
||||
$strTmp=strip_tags(@getTextInHtml($eco, ' class="tabligne" > Capital   (', '(', '</tr><tr>'));
|
||||
$tabTmp=explode(')', $strTmp);
|
||||
$this->capitalType=$tabTmp[0];
|
||||
$tabTmp=explode(' ', $tabTmp[1]);
|
||||
$this->capitalMontant=trim(str_replace(chr(160), '', $tabTmp[0]));
|
||||
$this->capitalDevise =trim(str_replace(chr(160), '', $tabTmp[1]));
|
||||
|
||||
$this->steInactive=trim(@getTextInHtml($eco, ' class="tabligne" > Société inactive</td>', 'class="tabval" >', '</td>'));
|
||||
|
||||
$this->dateCreation=trim(@getTextInHtml($eco, ' class="tabligne" > Date de création</td>', 'class="tabval" >', '</td>'));
|
||||
$this->fj=trim(@getTextInHtml($eco, ' class="tabligne" > Forme juridique</td>', 'class="tabval" >', '</td>'));
|
||||
$this->effectif=trim(@getTextInHtml($eco, ' class="tabligne" > Effectif', 'class="tabval" >', '</td>'));
|
||||
|
||||
if (count($this->tabDirigeants)==0) { // Si il y a déjà des dirigeants on garde ceux de Société.com !!!
|
||||
$strTmp=trim(@getTextInHtml($eco, ' class="tabligne" > Cotation en bourse</td>', '<td bgcolor="#F3E5CC" class="tabligne" >', '<td bgcolor="#F3E5CC" class="tabligne" > Effectif'));
|
||||
$tabTmp=explode('<td bgcolor="#F3E5CC" class="tabligne" >', $strTmp);
|
||||
foreach ($tabTmp as $k=>$dir) {
|
||||
$tabTmp1=explode('<td bgcolor="#FFF3DE" class="tabval" >', $dir);
|
||||
$tabTmp2=explode(' ', trim(strip_tags($tabTmp1[1])));
|
||||
$this->tabDirigeants[]=array('FONCTION'=>trim(strip_tags($tabTmp1[0])), 'GENRE'=>trim($tabTmp2[0]), 'PRENOM'=>trim($tabTmp2[1]), 'NOM'=>trim($tabTmp2[2]));
|
||||
}
|
||||
}
|
||||
|
||||
$this->strLiensFi=trim(strip_tags(@getTextInHtml($eco, '<td class="tabtot">LIENS FINANCIERS</td>', '<tr>', '</td></tr>')));
|
||||
$this->strElemsFi=trim(strip_tags(@getTextInHtml($eco, '<td class="tabtot">ELEMENTS FINANCIERS</td>', '<tr>', '</td></tr>')));
|
||||
}
|
||||
|
||||
$refererP='http://www.score3.fr/';
|
||||
$urlP='http://www.score3.fr/entreprise.shtml?siren='.$siren;
|
||||
$page=getUrl($urlP, '', '', $refererP, false, 'www.score3.fr');
|
||||
$pou=$page['body'];
|
||||
$fp=fopen('./pouet.html', 'w');
|
||||
fwrite($fp, $pou);
|
||||
fclose($fp);
|
||||
|
||||
if ($urlInfoD<>'') {
|
||||
$page=getUrl($urlInfoD,$strCookie,'', $refererInfoD, false, 'infobilan.decideur.com');
|
||||
$referer=$urlInfoD;
|
||||
if ($this->nscrl==0) $this->nscrl=@getTextInHtml($url, 'nscrlP=', '=','&');
|
||||
|
||||
$url=$urlRacine.'fiche_ident.html';
|
||||
$page=getUrl($url,$strCookie,'', $referer, false, 'infobilan.decideur.com');
|
||||
$this->body=$page['body'];
|
||||
|
||||
if ($this->raisonSociale=='')
|
||||
$this->raisonSociale=trim(@getTextInHtml($this->body, '<span class="libelle2">Société', ' :', '</span>'));
|
||||
|
||||
if ($this->adresse=='')
|
||||
$this->adresse=trim(@getTextInHtml($this->body, '<span class="libelle2">Adresse</span> <strong>:', '</strong>', '</td>'));
|
||||
|
||||
if ($this->tel=='')
|
||||
$this->tel=trim(@getTextInHtml($this->body, '<td valign="top"><span class="libelle2">Tél', '</span>', '<br>'));
|
||||
if ($this->fax=='')
|
||||
$this->fax=trim(@getTextInHtml($this->body, '<span class="libelle2">Fax</span>', ' :', '<br>'));
|
||||
if ($this->web=='')
|
||||
$this->web=trim(@getTextInHtml($this->body, '<span class="libelle2">Site Web</span>', '<a href="', '" target="_blank">'));
|
||||
if ($this->mail=='')
|
||||
$this->mail=trim(@getTextInHtml($this->body, '<span class="libelle2">E-mail</span>', '<a href="mailto:', '">'));
|
||||
if ($this->naf=='')
|
||||
$this->naf=trim(@getTextInHtml($this->body, '<span class="libelle2">Code NAF</span>', ' :', '</td>'));
|
||||
|
||||
if(preg_match('/<td valign="top"><span class="libelle2">Capital social<\/span> : (\d*)(.*)<br>/isU', $this->body, $matches)
|
||||
&& ($this->capitalMontant=='' || $this->capitalDevise=='')) {
|
||||
$this->capitalMontant=trim($matches[1]);
|
||||
$this->capitalDevise=trim($matches[2]);
|
||||
}
|
||||
|
||||
if ($this->fj=='')
|
||||
$this->fj=trim(@getTextInHtml($this->body, '<span class="libelle2">Forme juridique</span>', ' :', '<br>'));
|
||||
if ($this->nationalite=='')
|
||||
$this->nationalite=trim(@getTextInHtml($this->body, '<span class="libelle2">Nationalité</span>', ' :', '</td>'));
|
||||
if ($this->effectif=='')
|
||||
$this->effectif=trim(@getTextInHtml($this->body, '<td valign="top"><span class="libelle2">Effectif</span>', ' :', '<br>'));
|
||||
if ($this->activite=='')
|
||||
$this->activite=trim(@getTextInHtml($this->body, '<span class="libelle2">Activité</span>', ' :', '<br>'));
|
||||
|
||||
/** Actionnaires **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, 'ACTIONNAIRES<br>', '</div></h1>', '<h1>'));
|
||||
if(preg_match_all('/<p><span class="libelle2">(.*)<\/span> - <span class="libelle2">Participation<\/span> : (.*) %<br>(.*)<\/p>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nom) {
|
||||
$this->tabAct[$i]['nom']=trim($nom);
|
||||
$this->tabAct[$i]['pct']=trim($matches[2][$i]);
|
||||
$this->tabAct[$i]['rcs']=trim(str_replace('RCS : ','',strip_tags($matches[3][$i])));
|
||||
}
|
||||
}
|
||||
|
||||
/** Filiales **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, 'FILIALES<br>', '</div></h1>', '<h1>'));
|
||||
if(preg_match_all('/<p><span class="libelle2">(.*)<\/span> - <span class="libelle2">Participation<\/span> :(.*)%<br>(.*)<\/p>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nom) {
|
||||
$this->tabFil[$i]['nom']=trim($nom);
|
||||
$this->tabFil[$i]['pct']=trim($matches[2][$i]);
|
||||
$this->tabFil[$i]['rcs']=trim(str_replace('RCS :','',strip_tags($matches[3][$i])));
|
||||
}
|
||||
}
|
||||
|
||||
/** CA et Résultat **/
|
||||
$strTmp=trim(@getTextInHtml($this->body, '<h1>PRINCIPAUX ELEMENTS FINANCIERS<br>', '</div></h1>', '</p>'));
|
||||
if(preg_match('/<p><span class="libelle2">CA (.*)<\/span>(.*)<br>/isU', $strTmp, $matches)) {
|
||||
$this->derExerciceAnnee=trim($matches[1]);
|
||||
$this->derExerciceCA=trim(str_replace(':',' ', $matches[2]));
|
||||
}
|
||||
if(preg_match('/<span class="libelle2">Résultat(.*)<\/span>(.*)$/isU', $strTmp, $matches)) {
|
||||
$this->derExerciceResultat=trim(str_replace(':',' ', $matches[2]));
|
||||
}
|
||||
|
||||
$infoBilan=print_r($page, true);
|
||||
$fp=fopen('./infobilan.html', 'w');
|
||||
fwrite($fp, $infoBilan);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($this->nbEtab=='' || $this->nbEtab=='0') {
|
||||
$this->nbEtab=trim(strip_tags(str_replace('afficher la liste...', '', @getTextInHtml($pou, '<tr><td class="ligne1_2">Etablissements </td>', '<td class="ligne2_2">', '</td></tr>'))));
|
||||
$urlPEtab='http://www.score3.fr/etablissements.shtml?page=1&siren='.$siren;
|
||||
$refererPEtab=$urlP;
|
||||
$page=getUrl($urlPEtab, '', '', $refererPEtab, false, 'www.score3.fr');
|
||||
$pou2=$page['body'];
|
||||
if(preg_match_all('/<tr bgcolor="(?:\S*)"><td class="ligne1b" align="center" width="10%">(\d*)<\/td><td class="ligne2" height="50"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td class="infos">(.*)<\/td><\/tr><\/table>/isU', $pou2, $matches)) {
|
||||
foreach ($matches[1] as $i=>$nic) {
|
||||
$strEtab=$matches[2][$i];
|
||||
$this->tabEtab[$i]['siren']=$siren;
|
||||
$this->tabEtab[$i]['nic']=$nic;
|
||||
$this->tabEtab[$i]['siret']=$siren.$nic;
|
||||
|
||||
$this->tabEtab[$i]['enseigne']=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="titre3">', '">', '</span>')))));
|
||||
$this->tabEtab[$i]['adresse']=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="infos">', '">', '<br>')))));
|
||||
$strTmp=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '<span class="infos">', '<br>', '</span>')))));
|
||||
$tabTmp=explode(' ', $strTmp);
|
||||
$this->tabEtab[$i]['cp']=$tabTmp[0];
|
||||
unset($tabTmp[0]);
|
||||
$this->tabEtab[$i]['ville']=implode(' ',$tabTmp);
|
||||
$strTmp=trim(strip_tags(@getTextInHtml($strEtab, '<td class="infos" align="right" valign="top">', '">', ')')));
|
||||
$tabTmp=explode('(', $strTmp);
|
||||
$this->tabEtab[$i]['naf_code']=$tabTmp[1];
|
||||
$this->tabEtab[$i]['naf_lib']=trim(str_replace(chr(160),' ',utf8_decode($tabTmp[0])));
|
||||
if (preg_match('/<br>T.l\.(.*)$/i',$strEtab,$matches2))
|
||||
$this->tabEtab[$i]['tel']=trim(str_replace(chr(160),' ',utf8_decode($matches2[1])));
|
||||
else $this->tabEtab[$i]['tel']='';
|
||||
}
|
||||
}
|
||||
$this->nbEtab=count($this->tabEtab);
|
||||
$fp=fopen('./pouet_etab.html', 'w');
|
||||
fwrite($fp, $pou2);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
if ($this->effectif=='' || $this->effectif=='0' || $this->effectif=='NC')
|
||||
$this->effectif=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Effectifs</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->dateImmatriculation=='' || $this->dateImmatriculation=='0')
|
||||
$this->dateImmatriculation=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Date d\'immatriculation</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
if ($this->dateFermeture=='' || $this->dateFermeture=='0')
|
||||
$this->dateFermeture=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Date de fin d\'exploitation</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->tel=='' || $this->tel=='0')
|
||||
$this->tel=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Téléphone</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
if ($this->fax=='' || $this->fax=='0')
|
||||
$this->fax=trim(@getTextInHtml($pou, '<tr><td class="ligne1_2">Fax</td>', '<td class="ligne2_2">', '</td></tr>'));
|
||||
|
||||
$strTmp=trim(@getTextInHtml($pou, 'Procédures collectives</td></tr>', '</table></td>', '</td><td background'));
|
||||
if(preg_match_all('/<tr><td class="ligne1_2">(.*)<\/td><td class="ligne2_2">(.*)<\/td><\/tr>/isU', $strTmp, $matches)) {
|
||||
foreach ($matches[1] as $i=>$jug) {
|
||||
$this->tabJug[$i]['date']=$matches[1][$i];
|
||||
$this->tabJug[$i]['juge']=$matches[2][$i];
|
||||
}
|
||||
}
|
||||
|
||||
$this->score_pouey=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=pouey&valeur=', '">'));
|
||||
$this->score_conan=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=ch&valeur=', '">'));
|
||||
$this->score_afdcc=trim(@getTextInHtml($pou, '<param name="movie" value="cadran.swf?rotation=', '&type=afdcc&valeur=', '">'));
|
||||
$this->vigilance =trim(@getTextInHtml($pou, '<param name="movie" value="vigilance.swf', 'degre=', '">'));
|
||||
|
||||
if(preg_match('/Date de l\'exercice<\/td><td class="ligne2_2">(.*) sur (\d*) mois<\/td><\/tr>/isU', $pou, $matches)) {
|
||||
$this->derExerciceDClot=trim($matches[1]);
|
||||
$this->derExerciceDuree=trim($matches[2]);
|
||||
}
|
||||
|
||||
/* Siret SIEGE
|
||||
2 Fonction, Nom Prénoù ET Date NAissance du PP
|
||||
5 Liste des actes
|
||||
*/
|
||||
if ($this->codeRetour==200)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,365 +0,0 @@
|
||||
<?php
|
||||
require_once 'framework/common/curl.php';
|
||||
/** @todo A faire et sortir du coup la méthode de commande d'enquêtes du WS **/
|
||||
class Metier_Partenaires_MIntersud {
|
||||
|
||||
private $body = '';
|
||||
private $header = '';
|
||||
private $codeRetour = 0;
|
||||
private $cookie=false;
|
||||
private $reference = 0;
|
||||
private $timeOut=0;
|
||||
private $url='';
|
||||
private $urlRacine='http://www.intersud.fr';
|
||||
private $referer='';
|
||||
private $curPage='';
|
||||
public $siren;
|
||||
|
||||
function __construct() {
|
||||
$this->partGetSession();
|
||||
$this->partConnection();
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
$this->partSaveSession();
|
||||
}
|
||||
|
||||
function getInfosDisponbiles($siren) {
|
||||
$this->siren=$siren;
|
||||
$this->partConnection();
|
||||
return $this->partVitrine(true);
|
||||
}
|
||||
|
||||
private function partConnection() {
|
||||
if (!$this->wrncsrv2 || time()>$this->timeOut) {
|
||||
$this->timeOut=time()+900;
|
||||
|
||||
$this->url=$this->urlRacine.'/index.ow';
|
||||
$page=getUrl($this->url, '', '', $this->urlRacine, false, 'www.euridile.com');
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
//echo date('Y/m/d - H:i:s') ." - Initialisation URL = $this->url (Code retour = $this->codeRetour)<br/>".PHP_EOL;
|
||||
$fp=fopen('./euridile_connexion1.log', 'w');
|
||||
fwrite($fp,print_r($page,true));
|
||||
fclose($fp);
|
||||
if (preg_match('/<META HTTP-EQUIV="Refresh" CONTENT="0; URL=(.*)">/i', $this->body, $matches))
|
||||
$this->url=$this->urlRacine.'/'.$matches[1];
|
||||
else debugLog('E',"Erreur de communication - Redirection impossible sur ".$this->url,__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
debugLog('I','Redirection trouv<75>e sur la page '.$this->url,__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
|
||||
if (preg_match('/\.ow\?WRNCSRV2=(.*)$/i', $matches[1], $matches)) {
|
||||
$this->wrncsrv2=$matches[1];
|
||||
debugLog('I','Session partenaire WRNCSRV2='.$this->wrncsrv2,__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
}
|
||||
else debugLog('E','Impossible d\'identifier le num<75>ro de session partenaire',__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
|
||||
$page=getUrl($this->url, '', '',$this->referer, false, 'www.euridile.com');
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
debugLog('D',"Page d'accueil URL = $this->url (Code retour = $this->codeRetour)",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
$fp=fopen('./euridile_connexion2.log', 'w');
|
||||
fwrite($fp,print_r($page,true));
|
||||
fclose($fp);
|
||||
|
||||
if (preg_match('/<form method="POST" name="abonnement" ACTION="(.*)" /i', $this->body, $matches)) {
|
||||
$postData=array('IDENT'=>'OK',
|
||||
'MDP'=>'3180',
|
||||
'cliref'=>'K5K3X5',
|
||||
'PASS'=>'3180',
|
||||
'WRNCSRV2'=>$this->wrncsrv2);
|
||||
/** @todo Fair une fonction qui g<EFBFBD>re les URL commen<EFBFBD>ant par ./ ou ../ ou / afin de pouvoir les concatener
|
||||
**/
|
||||
$this->url=$this->urlRacine.str_replace('..','',$matches[1]);
|
||||
debugLog('D',"Authentification possible vers $this->url",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
}
|
||||
else debugLog('E',"Authentification impossible car formulaire indisponible",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
|
||||
sleep(1);
|
||||
$page=getUrl($this->url,'', $postData, $this->referer, false, 'www.euridile.com');
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
//echo date('Y/m/d - H:i:s') ." - Apr<70>s authentification = $this->url (Code retour = $this->codeRetour)<br/>".PHP_EOL;
|
||||
$fp=fopen('./euridile_connexion3.log', 'w');
|
||||
fwrite($fp,print_r($page,true));
|
||||
fclose($fp);
|
||||
|
||||
if(preg_match('/\/'.$this->weur.'\/iden_evaluation_type_(.*)/i', $this->body, $matches))
|
||||
{ $tabTmp=explode('"', $matches[0]);
|
||||
$this->url=$this->urlRacine.$tabTmp[0];
|
||||
debugLog('D',"Page de recherche recherche trouv<75>e = $this->url>",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
} else debugLog('E',"Erreur de communication - Recherche introuvable !",__LINE__,__FILE__,__FUNCTION__,__CLASS__);
|
||||
|
||||
$this->curPage='recherche';
|
||||
} //else echo date('Y/m/d - H:i:s') ." - Deja connecte !<br/>".PHP_EOL;
|
||||
return true;
|
||||
}
|
||||
|
||||
private function partIdentite() {
|
||||
if ($this->curPage<>'vitrine')
|
||||
$this->partVitrine();
|
||||
|
||||
$iDb=new WDB();
|
||||
$ret=$iDb->select( 'jo.rncs_entrep',
|
||||
'siren, rcs, nom, adresse1, adresse2, adresse3, cp, ville, naiss_date, naiss_lieu, sexe, enseigne, sigle, '.
|
||||
'fj_lib, naf_code, naf_lib, date_crea, date_imma, greffe, num_gestion, capital_mnt, capital_dev, nationalite, '.
|
||||
'nb_etab, indRadiation, date_radiation, indProcol, dateUpdate, procedures, dirigeants, etablissements',
|
||||
"siren=$this->siren ORDER BY dateUpdate DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
if (count($ret)) {
|
||||
/** On v<EFBFBD>rifie qu'aucune annonce n'a <EFBFBD>t<EFBFBD> publi<EFBFBD> depuis au bodacc
|
||||
**/
|
||||
$tabRet=$ret[0];
|
||||
$ret=$iDb->select( 'jo.bodacc_detail', 'count(*)',
|
||||
"siren=$this->siren AND Bodacc_Date_Parution>='".$tabRet['dateUpdate']."'");
|
||||
if ($ret[0][0]==0) {
|
||||
$tabRet['procedures']=unserialize($tabRet['procedures']);
|
||||
$tabRet['dirigeants']=unserialize($tabRet['dirigeants']);
|
||||
$tabRet['etablissements']=unserialize($tabRet['etablissements']);
|
||||
return $tabRet;
|
||||
}
|
||||
}
|
||||
|
||||
$url=$this->urlRacine.'/'.$this->weur.'/paie_abonnes_livraison_directe_informations.ow?flag_type_acces_direct_infos=FIC&WRNCSRV2='.$this->wrncsrv2;
|
||||
$page=getUrl($url, '', '', $this->referer, false, 'www.euridile.com');
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
//echo date('Y/m/d - H:i:s') ." - Fiche d'identit<69> = $url (Code retour = $this->codeRetour)<br/>".PHP_EOL;
|
||||
//$this->curPage='vitrine';
|
||||
$tabRet=array();
|
||||
|
||||
/**@todo Traiter le cas donn<EFBFBD>es provisoires :
|
||||
<TR><TD bgcolor='#fff0d0'><FONT COLOR=#100070 FACE=ARIAL SIZE=2><B><!-- Donn<6E>es provisoires --> En cours d'immatriculation, donn<6E>es provisoires</B></FONT></TD></TR><TR><TD bgcolor=#fff0d0><FONT COLOR=#100070 FACE=ARIAL SIZE=2>Nombre d'<27>tablissements : <FONT COLOR=#100070 FACE=ARIAL SIZE=2><B></B></TD></TR>
|
||||
</TABLE>
|
||||
*/
|
||||
// Identit<69>
|
||||
$tabRet['siren']=$this->siren;
|
||||
$tabRet['codeRetour']=$this->codeRetour;
|
||||
$tabRet['rcs']=@getTextInHtml($this->body, 'FACE="ARIAL,HELVETICA" SIZE=2>RCS : ', '<b>','</b>');
|
||||
$strTmp=@getTextInHtml($this->body, 'FACE="ARIAL,HELVETICA" SIZE=2>RCS : <b>', 'FACE="ARIAL,HELVETICA" SIZE=2><b>', '<img src=\'images/rouge.gif\'');
|
||||
$tabTmp=explode('</TD>', $strTmp);
|
||||
$tabRet['nom']=strip_tags($tabTmp[0]);
|
||||
// ... adresse
|
||||
for ($i=1; $i<5; $i++) {
|
||||
if (strpos($tabTmp[$i], 'Nom commercial - Enseigne :')===false &&
|
||||
strpos($tabTmp[$i], 'Sigle :')===false ) {
|
||||
$ligne=trim(strip_tags($tabTmp[$i]));
|
||||
if (preg_match("/^([0-9]{5,5})([\D]*)/i", $ligne, $matches)) {
|
||||
$tabRet['cp']=trim($matches[1]);
|
||||
$tabRet['ville']=trim($matches[2]);
|
||||
break;
|
||||
} else $tabRet['adresse'.$i]=$ligne;
|
||||
}
|
||||
}
|
||||
|
||||
$pp_nais=trim(strip_tags(@getTextInHtml($this->body, 'FACE=\'ARIAL,HELVETICA\' SIZE=2>Date et lieu de naissance :', '<B>','</B>')));
|
||||
$tabTmp=explode(' <20> ', $pp_nais);
|
||||
$tabRet['naiss_date']=trim(str_replace('N<>(e) le ', '', strip_tags($tabTmp[0])));
|
||||
$tabRet['naiss_lieu']=trim(strip_tags($tabTmp[1]));
|
||||
$tabRet['sexe']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=\'ARIAL,HELVETICA\' SIZE=2>Sexe :', '<B>','</B>')));
|
||||
|
||||
$tabRet['enseigne']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Nom commercial - Enseigne :', '<B>','</B>')));
|
||||
$tabRet['sigle']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Sigle :', '<B>','</B>')));
|
||||
$tabRet['fj_lib']=@getTextInHtml($this->body, 'FACE=\'ARIAL,HELVETICA\' SIZE=2>Forme juridique :', '<B>','</B>');
|
||||
$strTmp=@getTextInHtml($this->body, 'FACE=\'ARIAL,HELVETICA\' SIZE=2>Activité :', '<B>','</B>');
|
||||
$tabTmp=explode(' - ', $strTmp);
|
||||
$tabRet['naf_code']=$tabTmp[0];
|
||||
$tabRet['naf_lib']=$tabTmp[1];
|
||||
$tabRet['date_crea']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Date de création :', '<B>','</B>')));
|
||||
$tabRet['date_imma']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Date d\'immatriculation :', '<B>','</B>')));
|
||||
$tabRet['greffe']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Greffe :', '<B>','</B>')));
|
||||
$tabRet['num_gestion']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>N<>de gestion :', '<B>','</B>')));
|
||||
$strTmp=@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Capital :', '<B>','</B>');
|
||||
if (preg_match('/([0-9\.,\s]*)([\D]*)/i', $strTmp, $matches)) {
|
||||
$tabRet['capital_mnt']=trim(str_replace(' ','',str_replace(',','.',$matches[1])));
|
||||
$tabRet['capital_dev']=$matches[2];
|
||||
}
|
||||
else {
|
||||
$tabRet['capital_mnt']=0;
|
||||
$tabRet['capital_dev']='';
|
||||
}
|
||||
$tabRet['nationalite']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Nationalité :', '<B>','</B>')));
|
||||
$tabRet['nb_etab']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Nombre d\'<27>tablissements :', '<B>','</B>')));
|
||||
if (strpos($this->body,'FACE=ARIAL SIZE=2><B>Radiation</B>')>0) {
|
||||
$tabRet['indRadiation']=true;
|
||||
$tabRet['date_radiation']=trim(strip_tags(@getTextInHtml($this->body, 'FACE=ARIAL SIZE=2>Entreprise radi<64>e le :', '<B>','</B>')));
|
||||
} else
|
||||
$tabRet['indRadiation']=false;
|
||||
|
||||
// Proc<6F>dures collectives
|
||||
if (strpos($this->body,'FACE=ARIAL SIZE=2><B>Les proc<6F>dures collectives</B>')>0) {
|
||||
$tabRet['indProcol']=true;
|
||||
$strTmp=@getTextInHtml($this->body, '<B>Les proc<6F>dures collectives</B></FONT>', "<img src='./images/rouge.gif' width=4 height=4 border='0'>",
|
||||
'</TABLE>');
|
||||
$tabTmp=explode("<img src='./images/rouge.gif' width=4 height=4 border='0'>", $strTmp);
|
||||
foreach ($tabTmp as $nproc=>$proc) {
|
||||
$tabTmp2=explode('</TD></TR>', $proc);
|
||||
$tabTmp3=explode(' du ', $tabTmp2[0]);
|
||||
$tabTmp2=explode('<TD WIDTH=99% ALIGN=LEFT BGCOLOR=#fff0d0 colspan=2><FONT COLOR=#100070 FACE=ARIAL SIZE=2>', $proc);
|
||||
$tabInter=array();
|
||||
for($nInter=1; isset($tabTmp2[$nInter]); $nInter++) {
|
||||
$tabTmp4=explode('</TD></TR>', $tabTmp2[$nInter]);
|
||||
$tabInter[]=array( 'type'=>trim(strip_tags($tabTmp4[0])),
|
||||
'nom'=>trim(str_replace(' ','',strip_tags($tabTmp4[1]))),
|
||||
'adresse'=>trim(str_replace(' ','',strip_tags($tabTmp4[2]))),
|
||||
'cpVille'=>trim(str_replace(' ','',strip_tags($tabTmp4[3]))));
|
||||
}
|
||||
$tabRet['procedures'][$nproc]=array('type'=>trim(strip_tags($tabTmp3[0])),
|
||||
'date'=>trim(strip_tags($tabTmp3[1])),
|
||||
'intervenant'=>$tabInter);
|
||||
}
|
||||
}
|
||||
else $tabRet['indProcol']=false;
|
||||
|
||||
// Dirigeants
|
||||
$strTmp=@getTextInHtml($this->body, '<B>Les dirigeants</B></FONT>', "<img src='./images/rouge.gif' width=4 height=4 border='0'>",'</TABLE>');
|
||||
$tabTmp=explode("<img src='./images/rouge.gif' width=4 height=4 border='0'>", $strTmp);
|
||||
foreach ($tabTmp as $ndir=>$dir) {
|
||||
$tabTmp2=explode('</TD>', $dir);
|
||||
$tabTmp3=explode('</B> ', $tabTmp2[1]);
|
||||
$nom=trim(strip_tags($tabTmp3[0]));
|
||||
$prenom=trim(strip_tags($tabTmp3[1]));
|
||||
$naiss=trim(strip_tags($tabTmp2[3]));
|
||||
if (strpos($naiss, 'N<>(e) le')===false) {
|
||||
$fonction=$naiss;
|
||||
} else {
|
||||
$tabTmp3=explode(' <20> ', $naiss);
|
||||
$naiss_date=trim(str_replace('N<>(e) le ', '', strip_tags($tabTmp3[0])));
|
||||
$naiss=trim(strip_tags($tabTmp3[1]));
|
||||
$tabTmp3=explode('(', $naiss);
|
||||
$naiss_ville=trim(strip_tags($tabTmp3[0]));
|
||||
$naiss_depPays=trim(str_replace(')','', strip_tags($tabTmp3[1])));
|
||||
$fonction=trim(strip_tags($tabTmp2[5]));
|
||||
}
|
||||
$tabTmp=explode(' n<>e ', $prenom);
|
||||
$prenom=$tabTmp[0];
|
||||
$naiss_nom=$tabTmp[1];
|
||||
$tabRet['dirigeants'][$ndir]=array( 'nom'=>$nom,
|
||||
'prenom'=>$prenom,
|
||||
'naiss_nom'=>$naiss_nom,
|
||||
'naiss_date'=>$naiss_date,
|
||||
'naiss_ville'=>$naiss_ville,
|
||||
'naiss_depPays'=>$naiss_depPays,
|
||||
'fonction'=>$fonction);
|
||||
}
|
||||
|
||||
// Dirigeants - Administrateurs
|
||||
$strTmp=trim(@getTextInHtml($this->body, '<B>Les administrateurs</B></FONT>', "<img src='./images/rouge.gif' width=4 height=4 border='0'>",'</TABLE>'));
|
||||
if ($strTmp<>'') {
|
||||
$tabTmp=explode("<img src='./images/rouge.gif' width=4 height=4 border='0'>", $strTmp);
|
||||
foreach ($tabTmp as $nadm=>$dir) {
|
||||
$tabTmp2=explode('</TD>', $dir);
|
||||
$tabTmp3=explode('</B> ', $tabTmp2[1]);
|
||||
$nom=trim(strip_tags($tabTmp3[0]));
|
||||
$prenom=trim(strip_tags($tabTmp3[1]));
|
||||
$naiss=trim(strip_tags($tabTmp2[3]));
|
||||
if (strpos($naiss, 'N<>(e) le')===false) {
|
||||
$naiss_date=$naiss_ville=$naiss_depPays='';
|
||||
$fonction=$naiss;
|
||||
} else {
|
||||
$tabTmp3=explode(' <20> ', $naiss);
|
||||
$naiss_date=trim(str_replace('N<>(e) le ', '', strip_tags($tabTmp3[0])));
|
||||
$naiss=trim(strip_tags($tabTmp3[1]));
|
||||
$tabTmp3=explode('(', $naiss);
|
||||
$naiss_ville=trim(strip_tags($tabTmp3[0]));
|
||||
$naiss_depPays=trim(str_replace(')','', strip_tags($tabTmp3[1])));
|
||||
$fonction=trim(strip_tags($tabTmp2[5]));
|
||||
}
|
||||
$tabTmp=explode(' n<>e ', $prenom);
|
||||
$prenom=$tabTmp[0];
|
||||
$naiss_nom=$tabTmp[1];
|
||||
$tabRet['dirigeants'][$nadm+$ndir+1]=array( 'nom'=>$nom,
|
||||
'prenom'=>$prenom,
|
||||
'naiss_nom'=>$naiss_nom,
|
||||
'naiss_date'=>$naiss_date,
|
||||
'naiss_ville'=>$naiss_ville,
|
||||
'naiss_depPays'=>$naiss_depPays,
|
||||
'fonction'=>$fonction);
|
||||
}
|
||||
}
|
||||
|
||||
// Etablissements
|
||||
$strTmp=@getTextInHtml($this->body, '<B>Les <20>tablissements</B></FONT>', "<img src='./images/rouge.gif' width=4 height=4 border='0'>",'</TABLE>');
|
||||
$tabTmp=explode("<img src='./images/rouge.gif' width=4 height=4 border='0'>", $strTmp);
|
||||
foreach ($tabTmp as $netab=>$dir) {
|
||||
$cp=$ville=$ensEtab=''; $j=0;
|
||||
$tabTmp2=explode('</TD>', $dir);
|
||||
for($i=1; $i<=9; $i=$i+2) {
|
||||
$next=$i+2;
|
||||
$strTmp=trim(strip_tags($tabTmp2[$i]));
|
||||
if (preg_match("/^([0-9]{5,5})([\D]*)/i", $strTmp, $matches)) {
|
||||
$adresse[$j]='';
|
||||
$cp=trim($matches[1]);
|
||||
$ville=trim($matches[2]);
|
||||
break;
|
||||
} else
|
||||
$adresse[$j]=$strTmp;
|
||||
|
||||
$j++;
|
||||
}
|
||||
/** Gestion des cas o<> la 1<>re ligne d'adresse contient l'enseigne de l'<27>tablissement */
|
||||
if (strtoupper($adresse[0])==strtoupper($tabRet['enseigne'])) {
|
||||
$ensEtab=$adresse[0];
|
||||
array_shift($adresse);
|
||||
}
|
||||
$strTmp=trim(strip_tags($tabTmp2[$next]));
|
||||
$tabTmp3=explode(' - ', $strTmp);
|
||||
$tabRet['etablissements'][$netab]=array( 'enseigne'=>$ensEtab,
|
||||
'adresse1'=>$adresse[0],
|
||||
'adresse2'=>$adresse[1],
|
||||
'adresse3'=>$adresse[2],
|
||||
'cp'=>$cp,
|
||||
'ville'=>$ville,
|
||||
'naf_code'=>$tabTmp3[0],
|
||||
'naf_lib'=>$tabTmp3[1]);
|
||||
}
|
||||
|
||||
$fp=fopen('./euridile_identite.log', 'w');
|
||||
fwrite($fp,print_r($page,true));
|
||||
fclose($fp);
|
||||
|
||||
$tabInsert=$tabRet;
|
||||
$tabInsert['procedures']=serialize($tabRet['procedures']);
|
||||
$tabInsert['dirigeants']=serialize($tabRet['dirigeants']);
|
||||
$tabInsert['etablissements']=serialize($tabRet['etablissements']);
|
||||
|
||||
$iDb->insert( 'jo.rncs_entrep', $tabInsert);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
private function partSaveSession() {
|
||||
$fp=fopen('/tmp/php_rncs_session.id', 'w');
|
||||
fwrite($fp,$this->wrncsrv2.'^'.$this->timeOut.'^'.$this->curPage.'^'.$this->siren.'^'.$this->url.'^'.$this->referer);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
private function partGetSession() {
|
||||
$strTmp=@file_get_contents('/tmp/php_rncs_session.id');
|
||||
if ($strTmp) {
|
||||
$tabTmp=explode('^', $strTmp);
|
||||
$this->wrncsrv2=$tabTmp[0];
|
||||
$this->timeOut=$tabTmp[1];
|
||||
$this->curPage=$tabTmp[2];
|
||||
$this->siren=$tabTmp[3];
|
||||
$this->url=$tabTmp[4];
|
||||
$this->referer=$tabTmp[5];
|
||||
} else $this->timeOut=0;
|
||||
}
|
||||
|
||||
private function logEuridileError($message) {
|
||||
$fp=fopen('./euridile_error.log', 'w');
|
||||
fwrite($fp,date('Y/m/d H:i:s')." - Erreur : $message (".$this->wrncsrv2.'^'.$this->timeOut.'^'.$this->curPage.'^'.$this->siren.'^'.$this->url.'^'.$this->referer.')'.PHP_EOL);
|
||||
fwrite($fp,$this->body.PHP_EOL.'-------------------------------------------------------------------------------------'.PHP_EOL);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,922 +0,0 @@
|
||||
<?php
|
||||
global $tabOrt2Sd;
|
||||
$tabOrt2Sd=array( '_130000001'=>'SIREN',
|
||||
'_103000040'=>'CONSOLIDE',
|
||||
'_103000033'=>'DATE_CLOTURE',
|
||||
'_103000023'=>'DUREE_MOIS',
|
||||
'_103000202'=>'MONNAIE_ORI',
|
||||
'_103000205'=>'MONNAIE_ORI_UNITE',
|
||||
'_103000211'=>'MONNAIE',
|
||||
'_103000214'=>'MONNAIE_LIV_UNITE',
|
||||
'_103000029'=>'AVIS_CAC',
|
||||
'_130000009'=>'CODE_NAF',
|
||||
'_103101001'=>'AA',
|
||||
'_103101002'=>'AB',
|
||||
'_103101003'=>'AC',
|
||||
'_103101004'=>'AC1',
|
||||
'_103101005'=>'AD',
|
||||
'_103101006'=>'AE',
|
||||
'_103101007'=>'AE1',
|
||||
'_103101008'=>'AF',
|
||||
'_103101009'=>'AG',
|
||||
'_103101010'=>'AG1',
|
||||
'_103101011'=>'AH',
|
||||
'_103101012'=>'AI',
|
||||
'_103101013'=>'AI1',
|
||||
'_103101014'=>'AJ',
|
||||
'_103101015'=>'AK',
|
||||
'_103101016'=>'AK1',
|
||||
'_103101017'=>'AL',
|
||||
'_103101018'=>'AM',
|
||||
'_103101019'=>'AM1',
|
||||
'_103101020'=>'AN',
|
||||
'_103101021'=>'AO',
|
||||
'_103101022'=>'AO1',
|
||||
'_103101023'=>'AP',
|
||||
'_103101024'=>'AQ',
|
||||
'_103101025'=>'AQ1',
|
||||
'_103101026'=>'AR',
|
||||
'_103101027'=>'AS',
|
||||
'_103101028'=>'AS1',
|
||||
'_103101029'=>'AT',
|
||||
'_103101030'=>'AU',
|
||||
'_103101031'=>'AU1',
|
||||
'_103101032'=>'AV',
|
||||
'_103101033'=>'AW',
|
||||
'_103101034'=>'AW1',
|
||||
'_103101035'=>'AX',
|
||||
'_103101036'=>'AY',
|
||||
'_103101037'=>'AY1',
|
||||
'_103101038'=>'CS',
|
||||
'_103101039'=>'CT',
|
||||
'_103101040'=>'CT1',
|
||||
'_103101041'=>'CU',
|
||||
'_103101042'=>'CV',
|
||||
'_103101043'=>'CV1',
|
||||
'_103101044'=>'BB',
|
||||
'_103101045'=>'BC',
|
||||
'_103101046'=>'BC1',
|
||||
'_103101047'=>'BD',
|
||||
'_103101048'=>'BE',
|
||||
'_103101049'=>'BE1',
|
||||
'_103101050'=>'BF',
|
||||
'_103101051'=>'BG',
|
||||
'_103101052'=>'BG1',
|
||||
'_103101053'=>'BH',
|
||||
'_103101054'=>'BI',
|
||||
'_103101055'=>'BI1',
|
||||
'_103101056'=>'BJ',
|
||||
'_103101057'=>'BK',
|
||||
'_103101058'=>'BK1',
|
||||
'_103101059'=>'BL',
|
||||
'_103101060'=>'BM',
|
||||
'_103101061'=>'BM1',
|
||||
'_103101062'=>'BN',
|
||||
'_103101063'=>'BO',
|
||||
'_103101064'=>'BO1',
|
||||
'_103101065'=>'BP',
|
||||
'_103101066'=>'BQ',
|
||||
'_103101067'=>'BQ1',
|
||||
'_103101068'=>'BR',
|
||||
'_103101069'=>'BS',
|
||||
'_103101070'=>'BS1',
|
||||
'_103101071'=>'BT',
|
||||
'_103101072'=>'BU',
|
||||
'_103101073'=>'BU1',
|
||||
'_103101074'=>'BV',
|
||||
'_103101075'=>'BW',
|
||||
'_103101076'=>'BW1',
|
||||
'_103101077'=>'BX',
|
||||
'_103101078'=>'BY',
|
||||
'_103101079'=>'BY1',
|
||||
'_103101080'=>'BZ',
|
||||
'_103101081'=>'CA',
|
||||
'_103101082'=>'CA1',
|
||||
'_103101083'=>'CB',
|
||||
'_103101084'=>'CC',
|
||||
'_103101085'=>'CC1',
|
||||
'_103101086'=>'CD',
|
||||
'_103101087'=>'CE',
|
||||
'_103101088'=>'CE1',
|
||||
'_103101089'=>'CF',
|
||||
'_103101090'=>'CG',
|
||||
'_103101091'=>'CG1',
|
||||
'_103101092'=>'CH',
|
||||
'_103101093'=>'CI',
|
||||
'_103101094'=>'CI1',
|
||||
'_103101095'=>'CJ',
|
||||
'_103101096'=>'CK',
|
||||
'_103101097'=>'CK1',
|
||||
'_103101098'=>'CL',
|
||||
'_103101099'=>'CM',
|
||||
'_103101100'=>'CN',
|
||||
'_103101101'=>'CO',
|
||||
'_103101102'=>'1A',
|
||||
'_103101103'=>'1A1',
|
||||
'_103101104'=>'CP',
|
||||
'_103101105'=>'CR',
|
||||
'_103102001'=>'DA',
|
||||
'_103102002'=>'DB',
|
||||
'_103102003'=>'EK',
|
||||
'_103102004'=>'DC',
|
||||
'_103102005'=>'DD',
|
||||
'_103102006'=>'DE',
|
||||
'_103102007'=>'DF',
|
||||
'_103102008'=>'DG',
|
||||
'_103102009'=>'DH',
|
||||
'_103102010'=>'DI',
|
||||
'_103102011'=>'DJ',
|
||||
'_103102012'=>'DK',
|
||||
'_103102013'=>'DL',
|
||||
'_103102014'=>'DM',
|
||||
'_103102015'=>'DN',
|
||||
'_103102016'=>'DO',
|
||||
'_103102017'=>'DP',
|
||||
'_103102018'=>'DQ',
|
||||
'_103102019'=>'DR',
|
||||
'_103102020'=>'DS',
|
||||
'_103102021'=>'DT',
|
||||
'_103102022'=>'DU',
|
||||
'_103102023'=>'DV',
|
||||
'_103102024'=>'DW',
|
||||
'_103102025'=>'DX',
|
||||
'_103102026'=>'DY',
|
||||
'_103102027'=>'DZ',
|
||||
'_103102028'=>'EA',
|
||||
'_103102029'=>'EB',
|
||||
'_103102030'=>'EC',
|
||||
'_103102031'=>'ED',
|
||||
'_103102032'=>'EE',
|
||||
'_103102033'=>'EF',
|
||||
'_103102034'=>'EG',
|
||||
'_103102035'=>'EH',
|
||||
'_103102036'=>'EI',
|
||||
'_103103001'=>'FA',
|
||||
'_103103002'=>'FB',
|
||||
'_103103003'=>'FC',
|
||||
'_103103004'=>'FD',
|
||||
'_103103005'=>'FE',
|
||||
'_103103006'=>'FF',
|
||||
'_103103007'=>'FG',
|
||||
'_103103008'=>'FH',
|
||||
'_103103009'=>'FI',
|
||||
'_103103010'=>'FJ',
|
||||
'_103103011'=>'FK',
|
||||
'_103103012'=>'FL',
|
||||
'_103103013'=>'FM',
|
||||
'_103103014'=>'FN',
|
||||
'_103103015'=>'FO',
|
||||
'_103103016'=>'FP',
|
||||
'_103103017'=>'FQ',
|
||||
'_103103018'=>'FR',
|
||||
'_103103019'=>'FS',
|
||||
'_103103020'=>'FT',
|
||||
'_103103021'=>'FU',
|
||||
'_103103022'=>'FV',
|
||||
'_103103023'=>'FW',
|
||||
'_103103024'=>'FX',
|
||||
'_103103025'=>'FY',
|
||||
'_103103026'=>'FZ',
|
||||
'_103103027'=>'GA',
|
||||
'_103103028'=>'GB',
|
||||
'_103103029'=>'GC',
|
||||
'_103103030'=>'GD',
|
||||
'_103103031'=>'GE',
|
||||
'_103103032'=>'GF',
|
||||
'_103103033'=>'GG',
|
||||
'_103103034'=>'GH',
|
||||
'_103103035'=>'GI',
|
||||
'_103103036'=>'GJ',
|
||||
'_103103037'=>'GK',
|
||||
'_103103038'=>'GL',
|
||||
'_103103039'=>'GM',
|
||||
'_103103040'=>'GN',
|
||||
'_103103041'=>'GO',
|
||||
'_103103042'=>'GP',
|
||||
'_103103043'=>'GQ',
|
||||
'_103103044'=>'GR',
|
||||
'_103103045'=>'GS',
|
||||
'_103103046'=>'GT',
|
||||
'_103103047'=>'GU',
|
||||
'_103103048'=>'GV',
|
||||
'_103103049'=>'GW',
|
||||
'_103103050'=>'HA',
|
||||
'_103103051'=>'HB',
|
||||
'_103103052'=>'HC',
|
||||
'_103103053'=>'HD',
|
||||
'_103103054'=>'HE',
|
||||
'_103103055'=>'HF',
|
||||
'_103103056'=>'HG',
|
||||
'_103103057'=>'HH',
|
||||
'_103103058'=>'HI',
|
||||
'_103103059'=>'HJ',
|
||||
'_103103060'=>'HK',
|
||||
'_103103061'=>'HL',
|
||||
'_103103062'=>'HM',
|
||||
'_103103063'=>'HN',
|
||||
'_103103064'=>'HP',
|
||||
'_103103065'=>'HQ',
|
||||
'_103104077'=>'A1',
|
||||
'_103104078'=>'A2',
|
||||
'_103104079'=>'A3',
|
||||
'_103104080'=>'A4',
|
||||
'_103104001'=>'KF',
|
||||
'_103104002'=>'LP',
|
||||
'_103104003'=>'0J',
|
||||
'_103104004'=>'MY',
|
||||
'_103104005'=>'NC',
|
||||
'_103104006'=>'2E',
|
||||
'_103104007'=>'0K',
|
||||
'_103104008'=>'PD',
|
||||
'_103104009'=>'PH',
|
||||
'_103104010'=>'QX',
|
||||
'_103104011'=>'ON',
|
||||
'_103104012'=>'OP',
|
||||
'_103104013'=>'OQ',
|
||||
'_103104014'=>'OR',
|
||||
'_103104015'=>'SM',
|
||||
'_103104016'=>'SP',
|
||||
'_103104017'=>'5R',
|
||||
'_103104018'=>'5S',
|
||||
'_103104019'=>'5T',
|
||||
'_103104020'=>'5U',
|
||||
'_103104021'=>'7B',
|
||||
'_103104022'=>'TY',
|
||||
'_103104023'=>'TZ',
|
||||
'_103104024'=>'UA',
|
||||
'_103104025'=>'UF',
|
||||
'_103104026'=>'UH',
|
||||
'_103104027'=>'UK',
|
||||
'_103104028'=>'UM',
|
||||
'_103104029'=>'UR',
|
||||
'_103104030'=>'UV',
|
||||
'_103104031'=>'VA',
|
||||
'_103104032'=>'UY',
|
||||
'_103104033'=>'UZ',
|
||||
'_103104034'=>'VB',
|
||||
'_103104035'=>'VN',
|
||||
'_103104036'=>'VT',
|
||||
'_103104037'=>'VU',
|
||||
'_103104038'=>'VV',
|
||||
'_103104039'=>'7Y1',
|
||||
'_103104040'=>'7Z1',
|
||||
'_103104041'=>'VG',
|
||||
'_103104042'=>'VG1',
|
||||
'_103104043'=>'VH',
|
||||
'_103104044'=>'VH1',
|
||||
'_103104045'=>'8A1',
|
||||
'_103104046'=>'8B1',
|
||||
'_103104047'=>'8C',
|
||||
'_103104048'=>'8C1',
|
||||
'_103104049'=>'8D',
|
||||
'_103104050'=>'8D1',
|
||||
'_103104051'=>'8E1',
|
||||
'_103104052'=>'VW',
|
||||
'_103104053'=>'VW1',
|
||||
'_103104054'=>'VX',
|
||||
'_103104055'=>'VX1',
|
||||
'_103104056'=>'VQ',
|
||||
'_103104057'=>'VQ1',
|
||||
'_103104058'=>'8J1',
|
||||
'_103104059'=>'VI',
|
||||
'_103104060'=>'VI1',
|
||||
'_103104061'=>'8K1',
|
||||
'_103104062'=>'SZ1',
|
||||
'_103104063'=>'8L1',
|
||||
'_103104064'=>'VY',
|
||||
'_103104065'=>'VZ',
|
||||
'_103104066'=>'VZ1',
|
||||
'_103104067'=>'VZ2',
|
||||
'_103104068'=>'YQ',
|
||||
'_103104069'=>'YR',
|
||||
'_103104070'=>'YS',
|
||||
'_103104071'=>'YT',
|
||||
'_103104072'=>'YU',
|
||||
'_103104073'=>'YV',
|
||||
'_103104074'=>'YY',
|
||||
'_103104075'=>'YZ',
|
||||
'_103104076'=>'YP',
|
||||
'_103104081'=>'CZ',
|
||||
'_103104082'=>'KB',
|
||||
'_103104083'=>'KC',
|
||||
'_103104084'=>'KD',
|
||||
'_103104085'=>'KE',
|
||||
'_103104086'=>'LN',
|
||||
'_103104087'=>'LO',
|
||||
'_103104088'=>'LQ',
|
||||
'_103104089'=>'LR',
|
||||
'_103104090'=>'LS',
|
||||
'_103104091'=>'0G',
|
||||
'_103104092'=>'0H',
|
||||
'_103104093'=>'NL',
|
||||
'_103104094'=>'LT',
|
||||
'_103104095'=>'LU',
|
||||
'_103104096'=>'NO',
|
||||
'_103104097'=>'LV',
|
||||
'_103104098'=>'LW',
|
||||
'_103104099'=>'NN',
|
||||
'_103104100'=>'NG',
|
||||
'_103104101'=>'NH',
|
||||
'_103104102'=>'NM',
|
||||
'_103104103'=>'NJ',
|
||||
'_103104104'=>'NK',
|
||||
'_103104105'=>'NP',
|
||||
'_103104106'=>'0L',
|
||||
'_103104107'=>'PA',
|
||||
'_103104108'=>'PB',
|
||||
'_103104109'=>'PC',
|
||||
'_103104110'=>'PE',
|
||||
'_103104111'=>'PF',
|
||||
'_103104112'=>'PG',
|
||||
'_103104113'=>'QU',
|
||||
'_103104114'=>'QV',
|
||||
'_103104115'=>'QW',
|
||||
'_103104116'=>'Z91',
|
||||
'_103104117'=>'Z92',
|
||||
'_103104118'=>'SN',
|
||||
'_103104119'=>'SP_1',
|
||||
'_103104120'=>'SP_2',
|
||||
'_103104121'=>'SR',
|
||||
'_103104122'=>'TO',
|
||||
'_103104123'=>'3Z',
|
||||
'_103104124'=>'TS',
|
||||
'_103104125'=>'TT',
|
||||
'_103104126'=>'TU',
|
||||
'_103104127'=>'4D',
|
||||
'_103104128'=>'4H',
|
||||
'_103104129'=>'4M',
|
||||
'_103104130'=>'4S',
|
||||
'_103104131'=>'4W',
|
||||
'_103104132'=>'5A',
|
||||
'_103104133'=>'5E',
|
||||
'_103104134'=>'5K',
|
||||
'_103104135'=>'5P',
|
||||
'_103104136'=>'5Y',
|
||||
'_103104137'=>'5Z',
|
||||
'_103104138'=>'TV',
|
||||
'_103104139'=>'TW',
|
||||
'_103104140'=>'TX',
|
||||
'_103104141'=>'6A',
|
||||
'_103104142'=>'6B',
|
||||
'_103104143'=>'6C',
|
||||
'_103104144'=>'6D',
|
||||
'_103104145'=>'6E',
|
||||
'_103104146'=>'6F',
|
||||
'_103104147'=>'6G',
|
||||
'_103104148'=>'6H',
|
||||
'_103104149'=>'02',
|
||||
'_103104150'=>'03',
|
||||
'_103104151'=>'04',
|
||||
'_103104152'=>'05',
|
||||
'_103104153'=>'06',
|
||||
'_103104154'=>'07',
|
||||
'_103104155'=>'08',
|
||||
'_103104156'=>'09',
|
||||
'_103104157'=>'6N',
|
||||
'_103104158'=>'6P',
|
||||
'_103104159'=>'6R',
|
||||
'_103104160'=>'6S',
|
||||
'_103104161'=>'6T',
|
||||
'_103104162'=>'6U',
|
||||
'_103104163'=>'6V',
|
||||
'_103104164'=>'6W',
|
||||
'_103104165'=>'6X',
|
||||
'_103104166'=>'6Y',
|
||||
'_103104167'=>'6Z',
|
||||
'_103104168'=>'7A',
|
||||
'_103104169'=>'7C',
|
||||
'_103104170'=>'UB',
|
||||
'_103104171'=>'UC',
|
||||
'_103104172'=>'UD',
|
||||
'_103104173'=>'UE',
|
||||
'_103104174'=>'UG',
|
||||
'_103104175'=>'UJ',
|
||||
'_103104176'=>'UL',
|
||||
'_103104177'=>'UP',
|
||||
'_103104178'=>'UT',
|
||||
'_103104179'=>'UX',
|
||||
'_103104180'=>'UQ',
|
||||
'_103104181'=>'UU',
|
||||
'_103104182'=>'VM',
|
||||
'_103104183'=>'VP',
|
||||
'_103104184'=>'VC',
|
||||
'_103104185'=>'VR',
|
||||
'_103104186'=>'VS',
|
||||
'_103104187'=>'7Y',
|
||||
'_103104188'=>'7Y2',
|
||||
'_103104189'=>'7Z',
|
||||
'_103104190'=>'7Z2',
|
||||
'_103104191'=>'VG2',
|
||||
'_103104192'=>'VH2',
|
||||
'_103104193'=>'8A',
|
||||
'_103104194'=>'8A2',
|
||||
'_103104195'=>'8B',
|
||||
'_103104196'=>'8B2',
|
||||
'_103104197'=>'8C2',
|
||||
'_103104198'=>'8D2',
|
||||
'_103104199'=>'8E',
|
||||
'_103104200'=>'8E2',
|
||||
'_103104201'=>'VW2',
|
||||
'_103104202'=>'VX2',
|
||||
'_103104203'=>'VQ2',
|
||||
'_103104204'=>'8J',
|
||||
'_103104205'=>'8J2',
|
||||
'_103104206'=>'8J3',
|
||||
'_103104207'=>'VI2',
|
||||
'_103104208'=>'VI3',
|
||||
'_103104209'=>'8K',
|
||||
'_103104210'=>'8K2',
|
||||
'_103104211'=>'SZ',
|
||||
'_103104212'=>'SZ2',
|
||||
'_103104213'=>'8L',
|
||||
'_103104214'=>'8L2',
|
||||
'_103104215'=>'VJ',
|
||||
'_103104216'=>'VK',
|
||||
'_103104217'=>'ZE',
|
||||
'_103104218'=>'XQ',
|
||||
'_103104219'=>'SS',
|
||||
'_103104220'=>'ST',
|
||||
'_103104221'=>'ZJ',
|
||||
'_103104222'=>'YW',
|
||||
'_103104223'=>'9Z',
|
||||
'_103104224'=>'YX',
|
||||
'_103104225'=>'9X',
|
||||
'_103102037'=>'B1',
|
||||
'_103102038'=>'EJ',
|
||||
);
|
||||
|
||||
require_once 'framework/common/curl.php';
|
||||
|
||||
define('RNCS_WS_URL', 'http://www.services.ort.fr/ProtocoleRNCS/access');
|
||||
define('RNCS_WS_USER', '167260');
|
||||
define('RNCS_WS_PASS', '100356');
|
||||
|
||||
class Metier_Partenaires_MRncsFlux {
|
||||
|
||||
public $body = '';
|
||||
public $header = '';
|
||||
public $codeRetour = 0;
|
||||
public $errMsgInpi='';
|
||||
public $errNumInpi='';
|
||||
public $cookie='';
|
||||
public $iDb;
|
||||
public $tabVitrine=array();
|
||||
|
||||
|
||||
public $tabErreurInpi=array(0=>"Aucune erreur",
|
||||
10=>"Erreur de protocole avec système distant",
|
||||
11=>"Système distant inaccessible",
|
||||
101=>"Type de requête invalide",
|
||||
102=>"Code d'erreur appelant invalide",
|
||||
103=>"Identification non reconnue",
|
||||
107=>"Date invalide",
|
||||
108=>"Heure invalide",
|
||||
110=>"Code produit inconnu",
|
||||
115=>"Numéro de champ invalide",
|
||||
116=>"Longueur de champ invalide",
|
||||
121=>"Code de protocole invalide",
|
||||
122=>"Code base de données invalide",
|
||||
900=>"Erreur applicative",
|
||||
990100=>"+ de 50 entreprises trouvées",
|
||||
990101=>"Recherche complexe",
|
||||
990102=>"Critères saisis insuffisants",
|
||||
990103=>"Requête trop imprécise",
|
||||
990104=>"Dénomination non significative",
|
||||
990105=>"Critère commune non générall",
|
||||
990106=>"Critère voie trop général",
|
||||
990107=>"Commune obligatoire avec rue",
|
||||
990108=>"Commune non identifiée",
|
||||
990109=>"Entreprise non identifiée",
|
||||
990110=>"Erreur système",
|
||||
990111=>"Devise incorrecte",
|
||||
990112=>"Autre erreur",
|
||||
990113=>"Donnée incorrecte",
|
||||
990114=>"Valeur incohérente",
|
||||
990115=>"Surveillance impossible",
|
||||
990116=>"Entreprise non surveillée",
|
||||
990117=>"Entreprise déjà surveillée",
|
||||
990118=>"Produit indisponible",
|
||||
990119=>"Erreur base de données",
|
||||
990120=>"Erreur facturation",
|
||||
);
|
||||
|
||||
function __construct() {
|
||||
$this->iDb=new WDB();
|
||||
}
|
||||
|
||||
function getVitrine($siren) {
|
||||
$this->tabVitrine=$this->query($siren, array('Type'=>'QVIT'));
|
||||
return $this->tabVitrine;
|
||||
}
|
||||
|
||||
/*
|
||||
$cmdPages=$cmdNom='';
|
||||
|
||||
if (isset($_REQUEST['pages'])) $cmdPages=$_REQUEST['pages'];
|
||||
if (isset($_REQUEST['nom'])) $cmdNom=$_REQUEST['nom'];
|
||||
if (isset($_REQUEST['vue'])) $vue=$_REQUEST['vue'];
|
||||
|
||||
if ($vue=='bilans') $presta='12004';
|
||||
else $presta='12003';
|
||||
|
||||
if ($cmdNom && $cmdPages) $type='QDOC';
|
||||
else $type='QVIT';
|
||||
$prod=array('Type'=>$type,
|
||||
'Presta'=>$presta,
|
||||
'Num'=>'2',//2,
|
||||
'Ver'=>'2',//2,
|
||||
'Siren'=>$siren,
|
||||
'CmdNom'=>$cmdNom,
|
||||
'CmdPages'=>$cmdPages,
|
||||
'CmdBilan'=>'',
|
||||
);
|
||||
|
||||
$ref='';
|
||||
*/
|
||||
|
||||
public function query($siren, $prod=array()) {
|
||||
/*$prod=array('Type'=>$type,
|
||||
'Presta'=>$presta,
|
||||
'Siren'=>$siren,
|
||||
'CmdNom'=>$cmdNom,
|
||||
'CmdPages'=>$cmdPages,
|
||||
'CmdBilan'=>'',
|
||||
'Ref'=>'',
|
||||
);
|
||||
*/
|
||||
$option='';
|
||||
if ( ($prod['Type']=='QDOC' || $prod['Presta']==12004 || $prod['Presta']==12003) && !isset($prod['Num'])) {
|
||||
$prod['Num']=2;
|
||||
$prod['Ver']=2;
|
||||
} elseif (!isset($prod['Num'])) {
|
||||
$prod['Num']=1;
|
||||
$prod['Ver']=3;
|
||||
}
|
||||
|
||||
$req= '<?xml version="1.0" ?>'. "\n".
|
||||
'<ort:message xmlns:ort="http://www.ort.fr/NEWPORT/V2">'. "\n".
|
||||
' <ort:_1 type="110">'. "\n".
|
||||
' <ort:_7 type="010">NPORT</ort:_7>'. "\n".
|
||||
' <ort:_8 type="010">2</ort:_8>'. "\n". // Version du protocole
|
||||
' <ort:_9 type="010">1</ort:_9>'. "\n". // Version du dictionnaire
|
||||
' <ort:_10 type="010">1</ort:_10>'. "\n". // Code protocole/version application
|
||||
' <ort:_11 type="010">PROTORNCS</ort:_11>'. "\n".
|
||||
' <ort:_12 type="010">'.$prod['Type'].'</ort:_12>'. "\n". // Prestation souhaitée QVIT / QDOC
|
||||
' <ort:_13 type="010">0</ort:_13>'. "\n". // Code retour/erreur
|
||||
' <ort:_14 type="010">'.RNCS_WS_USER.RNCS_WS_PASS.'</ort:_14>'."\n". // User Password concaténés
|
||||
' <ort:_15 type="010">'.$prod['Ref'].'</ort:_15>'. "\n". // Réf.
|
||||
' <ort:_16 type="010">'.date('Ymd').'</ort:_16>'. "\n". // Date SSAAMMJJ
|
||||
' <ort:_17 type="010">'.date('His').'</ort:_17>'. "\n". // Heure HHMMSS
|
||||
' <ort:_19 type="010">ORT</ort:_19>'. "\n".
|
||||
' </ort:_1>'. "\n".
|
||||
' <ort:_2 type="110">'. "\n".
|
||||
' <ort:_1 type="110">'. "\n".
|
||||
' <ort:_26 type="010">'.$prod['Prod'].'</ort:_26>'. "\n". // Type de produit (vide pour QVIT)
|
||||
' <ort:_27 type="010">'.$prod['Num'].'</ort:_27>'. "\n". // Numéro de produit souhaité 1 2
|
||||
' <ort:_28 type="010">'.$prod['Ver'].'</ort:_28>'. "\n". // Version du produit 3 2
|
||||
' <ort:_31 type="010">'.$prod['Presta'].'</ort:_31>'. "\n". // Code prestation (vide pour QVIT)
|
||||
' </ort:_1>'. "\n";
|
||||
if ($prod['Presta']==12004 || $prod['Presta']==12003) {
|
||||
$req.='
|
||||
<ort:_2 type="110">
|
||||
<ort:_100 type="111">
|
||||
<ort:_101 type="110">
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
<ort:_100700010 type="010">FTP</ort:_100700010>
|
||||
<ort:_100701000 type="010">NTIF</ort:_100701000>
|
||||
<ort:_120000015 type="010" />
|
||||
</ort:_101>
|
||||
</ort:_100>
|
||||
<ort:_200 type="111">
|
||||
<ort:_210 type="110">
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_103000402 type="010">'.$prod['CmdNom'].'</ort:_103000402>
|
||||
<ort:_103000403 type="010">'.$prod['CmdPages'].'</ort:_103000403>
|
||||
<ort:_190000025 type="010">'.$prod['CmdBilan'].'</ort:_190000025>
|
||||
</ort:_210>
|
||||
</ort:_200>
|
||||
</ort:_2>'; //
|
||||
$option=$prod['CmdNom'].'-'.$prod['CmdPages'].'-'.$prod['CmdBilan'];
|
||||
} elseif ($prod['Type']=='QINF') {
|
||||
$req.=' <ort:_2 type="110">'."\n".'<ort:_130000001 type="010">'.$siren.'</ort:_130000001>';
|
||||
if ($prod['Presta']=='2000' || $prod['Presta']=='2001' || $prod['Presta']=='2002' || $prod['Presta']=='2003') {
|
||||
// Liste années bilans
|
||||
$req.='<ort:_190000025 type="010">'.$prod['Millesime'].'</ort:_190000025>'."\n";
|
||||
$option=$prod['Millesime'];
|
||||
}
|
||||
elseif ($prod['Presta']=='12001')
|
||||
// Flag limitation du nombre détablissement
|
||||
$req.='<ort:_109105002 type="010">N</ort:_109105002>'."\n";
|
||||
$req.='</ort:_2>';
|
||||
} else {
|
||||
$req.=' <ort:_2 type="110">
|
||||
<ort:_130000001 type="010">'.$siren.'</ort:_130000001>
|
||||
<ort:_120000031 type="010">'.$prod['Presta'].'</ort:_120000031>
|
||||
</ort:_2>';// 12003 Actes et statuts 12004 Bilans
|
||||
}
|
||||
$req.=' </ort:_2>
|
||||
</ort:message>';
|
||||
echo $req.'<hr/>';
|
||||
$postData=array(''=>$req);
|
||||
$cookie=$referer='';
|
||||
$enCache=false;
|
||||
$params=md5(serialize($prod));
|
||||
//die($params);
|
||||
/*if ($prod['CmdNom']<>'' || $prod['CmdPages']<>'' || $prod['CmdBilan']<>'' || $prod['Millesime']<>'')
|
||||
$strOption=*/
|
||||
//AND params='$params'
|
||||
$res=$this->iDb->select('rncs_requetes', 'dateRequete, strXml, codeErreur, libErreur', "siren=$siren AND params='$params' ORDER BY dateRequete DESC");
|
||||
//type='".$prod['Type']."' AND presta ='".$prod['Presta']."' $strOption ORDER BY dateRequete DESC");
|
||||
if (count($res)>0) {
|
||||
$tabRes=$res[0];
|
||||
$dateReq=$tabRes['dateRequete'];
|
||||
$this->body=$tabRes['strXml'];
|
||||
$this->errNumInpi=$tabRes['codeErreur'];
|
||||
$this->errMsgInpi=$tabRes['libErreur'];
|
||||
$enCache=true;
|
||||
echo 'Une requête dans le cache <br/>';
|
||||
//die();
|
||||
} else {
|
||||
echo 'Pas de requête dans le cache <br/>';
|
||||
//die();
|
||||
$page=getUrl(RNCS_WS_URL, $cookie, $postData, $referer, false, 'www.services.ort.fr');
|
||||
$this->body=$page['body'];
|
||||
/**
|
||||
** ERREUR PROTOCOL
|
||||
**/
|
||||
preg_match('/<ort:_13 type="020">(.*)<\/ort:_13>/Uis',$this->body, $matches);
|
||||
if ($matches[1]*1<>0) {
|
||||
$this->errNumInpi=$matches[1];
|
||||
$this->errMsgInpi=$tabErreurInpi[$this->errNumInpi];
|
||||
//echo "<!-- ERREUR INPI 13 n°$errNumInpi = $errMsgInpi !!! -->\n";
|
||||
}
|
||||
|
||||
/**
|
||||
** ERREUR APPLICATIVES NUMERIQUES
|
||||
**/
|
||||
preg_match('/<ort:_96 type="020">(.*)<\/ort:_96>/Uis',$this->body, $matches);
|
||||
if ($matches[1]*1<>0) {
|
||||
$this->errNumInpi=$matches[1];
|
||||
$this->errMsgInpi=$tabErreurInpi[$this->errNumInpi];
|
||||
//echo "<!-- ERREUR INPI 96 n°$errNumInpi = $errMsgInpi !!! -->\n";
|
||||
}
|
||||
|
||||
/**
|
||||
** ERREUR APPLICATIVES TEXTE
|
||||
**/
|
||||
preg_match('/<ort:_97 type="010">(.*)<\/ort:_97>/Uis',$this->body, $matches);
|
||||
if ($matches[1]*1<>0) {
|
||||
$this->errMsgInpi=$matches[1];
|
||||
//echo "<!-- ERREUR INPI 97 : $errMsgInpi !!! -->\n";
|
||||
}
|
||||
|
||||
$tabInsert=array( 'siren' => $siren,
|
||||
'dateRequete' => date('YmdHis'),
|
||||
'strXml' => $this->body,
|
||||
'params' => md5(serialize($prod)),
|
||||
'type' => $prod['Type'],
|
||||
'presta' => $prod['Presta'],
|
||||
'option' => $option,
|
||||
'codeErreur' => $this->errNumInpi,
|
||||
'libErreur' => $this->errMsgInpi,
|
||||
);
|
||||
$this->iDb->insert('jo.rncs_requetes', $tabInsert, true);
|
||||
}
|
||||
|
||||
if ($prod['Presta']==12004)
|
||||
// bilans image
|
||||
$pregmatch=preg_match_all('/<ort\:_201 type="110">(?:.*)<ort\:_103000040 type="010">(.*)<\/ort:_103000040>(?:.*)<ort\:_103000452 type="010">(.*)<\/ort:_103000452>(?:.*)<ort\:_103000402 type="010">(.*)<\/ort:_103000402>(?:.*)<ort\:_103000403 type="010">(.*)<\/ort:_103000403>(?:.*)<ort\:_103000404 type="010">(.*)<\/ort:_103000404>(?:.*)<\/ort:_201>/Uis',$this->body, $matches);
|
||||
elseif ($prod['Presta']==12003)
|
||||
// actes image
|
||||
$pregmatch=preg_match_all('/<ort\:_201 type="110">(?:.*)<ort\:_103000452 type="010">(.*)<\/ort:_103000452>(?:.*)<ort\:_103000402 type="010">(.*)<\/ort:_103000402>(?:.*)<ort\:_103000403 type="010">(.*)<\/ort:_103000403>(?:.*)<ort\:_103000404 type="010">(.*)<\/ort:_103000404>(?:.*)<\/ort:_201>/Uis',$this->body, $matches);
|
||||
elseif ($prod['Presta']==2000)
|
||||
// bilan simplifiés ou normaux saisi
|
||||
$pregmatch=preg_match('/<ort\:_2 type="110">(?:.*)<ort\:_2 type="110">(.*)<\/ort\:_2>(?:.*)<\/ort\:_2>/Uis',$this->body, $matches);
|
||||
elseif ($prod['Presta']==12001)
|
||||
// Fiche Identite
|
||||
$pregmatch=preg_match('/<ort\:_2 type="110">(?:.*)<ort\:_2 type="110">(.*)<\/ort\:_2>(?:.*)<\/ort\:_2>/Uis',$this->body, $matches);
|
||||
else {
|
||||
// Prestation Vitrine
|
||||
$tabVitrine=array();
|
||||
|
||||
// Bilans dispos
|
||||
$tabBilans=array();
|
||||
// Type de Bilans saisis disponible
|
||||
for ($typeBilan=2000; $typeBilan<2004; $typeBilan++) {
|
||||
$pregmatch=preg_match('/<ort:_'.$typeBilan.' type="110">(?:.*)<ort\:_120000026 type="010">(.*)<\/ort\:_120000026>(?:.*)<ort\:_120000027 type="010">(.*)<\/ort\:_120000027>(?:.*)<ort\:_120000028 type="010">(.*)<\/ort\:_120000028>(?:.*)<ort\:_120000029 type="010">(.*)<\/ort:_120000029>(?:.*)<ort\:_120000031 type="010">(.*)<\/ort\:_120000031>(?:.*)<ort\:_109104002 type="010">(.*)<\/ort\:_109104002>(?:.*)<ort\:_109104003 type="010">(.*)<\/ort\:_109104003>(.*)<\/ort:_'.$typeBilan.'>/Uis',$this->body, $matches);
|
||||
$numProduit=$matches[1]; // 52
|
||||
$numProduit=$matches[2]; // 52
|
||||
$verProduit=$matches[3]; // 1
|
||||
$libProduit=$matches[4]; // Comptes sociaux
|
||||
$typProduit=$matches[5]; // 2000 : Bilans sociaux
|
||||
// 2001 : Bilans consolidés (70)
|
||||
// 2002 : Bilans de banques (71)
|
||||
// 2003 : Bilans d'assurances (72)
|
||||
$synProduit=$matches[6]; // 109104002 : Disponibilité synchrone
|
||||
$asyProduit=$matches[7]; // 109104003 : Disponibilité asynchrone
|
||||
$pregmatch=preg_match_all('/<ort\:_103000038 type="010">(.*)<\/ort:_103000038>/Uis',$matches[8], $matches);
|
||||
if ($typeBilan==2000) $tabBilans['N']=$matches[1]; // Réel normal SC
|
||||
elseif ($typeBilan==2001) $tabBilans['C']=$matches[1]; // Consolidé CC
|
||||
elseif ($typeBilan==2002) $tabBilans['B']=$matches[1]; // Banque SB
|
||||
elseif ($typeBilan==2003) $tabBilans['A']=$matches[1]; // Assurance SA
|
||||
else $tabBilans['S']=$matches[1]; // Réel Simplifié SS
|
||||
}
|
||||
$tabVitrine['bilans']=$tabBilans;
|
||||
|
||||
// Fiche d'identité
|
||||
$pregmatch=preg_match('/<ort:_12001 type="110">(?:.*)<ort\:_120000027 type="010">(.*)<\/ort\:_120000027>(?:.*)<ort\:_120000028 type="010">(.*)<\/ort\:_120000028>(?:.*)<ort\:_120000029 type="010">(.*)<\/ort:_120000029>(?:.*)<ort\:_120000031 type="010">(.*)<\/ort\:_120000031>(?:.*)<ort\:_109104002 type="010">(.*)<\/ort\:_109104002>(?:.*)<ort\:_109104003 type="010">(.*)<\/ort\:_109104003>(?:.*)<ort\:_130000401 type="010">(.*)<\/ort\:_130000401>(?:.*)<\/ort:_12001>/Uis',$this->body, $matches);
|
||||
$numProduit=$matches[1]; // 52
|
||||
$verProduit=$matches[2]; // 1
|
||||
$libProduit=$matches[3]; // Comptes sociaux
|
||||
$typProduit=$matches[4]; // 2000 : Bilans sociaux
|
||||
$synProduit=$matches[5]; // 109104002 : Disponibilité synchrone
|
||||
$asyProduit=$matches[6]; // 109104003 : Disponibilité asynchrone
|
||||
$nbEtab=$matches[7]; // Nombre d'établissements recensés
|
||||
$tabVitrine['identite']=array( 'numProduit'=>$numProduit,
|
||||
'verProduit'=>$verProduit,
|
||||
'libProduit'=>$libProduit,
|
||||
'typProduit'=>$typProduit,
|
||||
'synProduit'=>$synProduit,
|
||||
'asyProduit'=>$asyProduit,
|
||||
'nbEtab' =>$nbEtab);
|
||||
|
||||
return $tabVitrine;
|
||||
}
|
||||
|
||||
echo $this->body;
|
||||
|
||||
//print_r($tabBilans);
|
||||
return $matches;
|
||||
}
|
||||
|
||||
function getListeBilans($siren, $type='*') {
|
||||
$tabVitrine=$this->getVitrine($siren);
|
||||
foreach ($tabVitrine['bilans'] as $type => $tabMillesime) {
|
||||
foreach ($tabMillesime as $num=>$millesime) {
|
||||
$delta1=round((Wdate::dateT('d/m/Y','Y',$millesime)-Wdate::dateT('d/m/Y','Y',$tabMillesime[$num+1]))*12)
|
||||
+round(Wdate::dateT('d/m/Y','m',$millesime)-Wdate::dateT('d/m/Y','m',$tabMillesime[$num+1]));
|
||||
if ($delta1>23) $delta1=0;
|
||||
$delta2=round((Wdate::dateT('d/m/Y','Y',$tabMillesime[$num+1])-Wdate::dateT('d/m/Y','Y',$tabMillesime[$num+2]))*12)
|
||||
+round(Wdate::dateT('d/m/Y','m',$tabMillesime[$num+1])-Wdate::dateT('d/m/Y','m',$tabMillesime[$num+2]));
|
||||
if ($delta2>23) $delta2=0;
|
||||
$tabRet[$type.$millesime]=array( 'dateProvPartenaire'=>date('Ymd'),
|
||||
'dureeExercice' =>$delta1,
|
||||
'dateExercicePre' =>Wdate::dateT('d/m/Y','Ymd',$tabMillesime[$num+1]),
|
||||
'dureeExercicePre' =>$delta2,
|
||||
'monnaie' =>'EUR',
|
||||
'source' =>100,
|
||||
'ref' =>'',
|
||||
);
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function getBilan($siren, $millesime, $type='N') {
|
||||
global $tabOrt2Sd;
|
||||
$tabRet=$tabPostes=array();
|
||||
if ($type=='N') $presta=2000;
|
||||
elseif ($type=='C') $presta=2001;
|
||||
elseif ($type=='B') $presta=2002;
|
||||
elseif ($type=='A') $presta=2003;
|
||||
$prod=array( 'Prod'=>'RNCS',
|
||||
'Num'=>'52',
|
||||
'Ver'=>'1',
|
||||
'Presta'=>$presta,
|
||||
'Millesime'=>Wdate::dateT('d/m/Y','mY',$millesime),
|
||||
'Type'=>'QINF');
|
||||
$ret=$this->query($siren, $prod);
|
||||
|
||||
/* $fp=fopen(LOG_PATH.'/debugBilansRncs.log','a');
|
||||
fwrite($fp, print_r($ret,true));
|
||||
fclose($fp);*/
|
||||
|
||||
$pregmatch=preg_match_all('/<ort\:_(.*) type="010">(.*)<\/ort\:_(.*)>/Uis', $ret[1], $matches);
|
||||
foreach ($matches[1] as $i=>$poste) {
|
||||
//echo "$i : $poste<br/>";
|
||||
if ('_'.$poste=='_103000040') { // CONSOLIDE
|
||||
switch ($matches[2][$i]) {
|
||||
case 'SC': $tabRet[$tabOrt2Sd['_'.$poste]]='N'; break;
|
||||
case 'CC': $tabRet[$tabOrt2Sd['_'.$poste]]='C'; break;
|
||||
case 'SB': $tabRet[$tabOrt2Sd['_'.$poste]]='B'; break;
|
||||
case 'SA': $tabRet[$tabOrt2Sd['_'.$poste]]='A'; break;
|
||||
case 'SS': $tabRet[$tabOrt2Sd['_'.$poste]]='S'; break;
|
||||
default: break;
|
||||
}
|
||||
} elseif ('_'.$poste=='_103000214') { // MONNAIE_LIV_UNITE
|
||||
switch ($matches[2][$i]*1) {
|
||||
case 0: $tabRet[$tabOrt2Sd['_'.$poste]]=''; break;
|
||||
case 3: $tabRet[$tabOrt2Sd['_'.$poste]]='k'; break;
|
||||
case 6: $tabRet[$tabOrt2Sd['_'.$poste]]='m'; break;
|
||||
default: break;
|
||||
}
|
||||
} elseif ('_'.$poste=='_130000001' || // SIREN
|
||||
'_'.$poste=='_103000033' || // DATE_CLOTURE
|
||||
'_'.$poste=='_103000023' || // DUREE_MOIS
|
||||
'_'.$poste=='_103000202' || // MONNAIE_ORI
|
||||
'_'.$poste=='_103000205' || // MONNAIE_ORI_UNITE
|
||||
'_'.$poste=='_103000211' || // MONNAIE
|
||||
'_'.$poste=='_103000029' || // AVIS_CAC
|
||||
'_'.$poste=='_130000009') { // CODE_NAF
|
||||
$tabRet[$tabOrt2Sd['_'.$poste]]=$matches[2][$i];
|
||||
} else
|
||||
$tabPostes[$tabOrt2Sd['_'.$poste]]=$matches[2][$i];
|
||||
}
|
||||
$tabRet['POSTES']=$tabPostes;
|
||||
$tabRet['DATE_FRAICHE_BILAN']=date('Ymd');
|
||||
$tabRet['TYPE_BILAN']=$tabRet['CONSOLIDE'];
|
||||
//$tabRet['DATE_CLOTURE_PRE']
|
||||
//$tabRet['DUREE_MOIS_PRE']
|
||||
$fp=fopen(LOG_PATH.'/debugBilansRncs.log','a');
|
||||
fwrite($fp, print_r($tabRet,true));
|
||||
fclose($fp);
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
function getIdentite($siren) {
|
||||
$tabVitrine=$this->getVitrine($siren);
|
||||
|
||||
$fp=fopen(LOG_PATH.'/debugVitrineRncs.log','a');
|
||||
fwrite($fp, print_r($tabVitrine,true));
|
||||
fclose($fp);
|
||||
|
||||
$prod=array( 'Prod'=>'RNCS',
|
||||
'Num'=>$tabVitrine['identite']['numProduit'],
|
||||
'Ver'=>$tabVitrine['identite']['verProduit'],
|
||||
'Presta'=>12001,
|
||||
'Type'=>'QINF');
|
||||
$ret=$this->query($siren, $prod);
|
||||
if ($this->errNumInpi>0 && $this->errMsgInpi<>'') {
|
||||
return false;
|
||||
} else {
|
||||
$pregmatch=preg_match_all('/<ort\:_((?:1300|13011|13016|130100403).*) type="010">(.*)<\/ort\:_((?:1300|13011|13016|130100403).*)>/Uis', $ret[1], $matchesIden);
|
||||
foreach ($matchesIden[1] as $i=>$rubrique) {
|
||||
if ($rubrique==130000300) $tabIdentite['Nom']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000008) $tabIdentite['FJ']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000303) $tabIdentite['Sigle']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130100015) $tabIdentite['Enseigne']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000500) $tabIdentite['CapitalMont']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000501) $tabIdentite['CapitalType']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000508) $tabIdentite['CapitalDev']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000509) $tabIdentite['CapitalUnite']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000513) $tabIdentite['CapitalMontCts']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000102) $tabIdentite['DateCrea']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130001002) $tabIdentite['DateImma']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000013) $tabIdentite['CodeGreffe']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000014) $tabIdentite['NumRC']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130001102) $tabIdentite['DateRad']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000025) $tabIdentite['Provisoire']=$matchesIden[2][$i];
|
||||
elseif ($rubrique==130000401) $tabIdentite['NbEtab']=$matchesIden[2][$i];
|
||||
}
|
||||
|
||||
/** DIRIGEANTS **/
|
||||
$tabDir=array();
|
||||
if (preg_match('/<ort\:_130300015 type="010">(.*)<\/ort:_130300015>(?:.*)<ort:_200 type="111">(.*)<\/ort\:_200>/Uis', $ret[1], $matchesDirs)) {
|
||||
$nbDirs=$matchesDirs[1];
|
||||
$strDir=$matchesDirs[2];
|
||||
$strMatch= '<ort\:_210 type="110">(?:.*)'.
|
||||
'<ort\:_130300005 type="010">(.*)<\/ort\:_130300005>(?:.*)'.
|
||||
'<ort\:_130301003 type="010">(.*)<\/ort\:_130301003>(?:.*)'.
|
||||
'<ort\:_130300016 type="010">(.*)<\/ort\:_130300016>(?:.*)'.
|
||||
'<ort\:_130301006 type="010">(.*)<\/ort\:_130301006>(?:.*)'.
|
||||
'<ort\:_130301007 type="010">(.*)<\/ort\:_130301007>(?:.*)'.
|
||||
'<ort\:_130301009 type="010">(.*)<\/ort\:_130301009>(?:.*)'.
|
||||
'<ort\:_130301004 type="010">(.*)<\/ort\:_130301004>(?:.*)'.
|
||||
'<ort\:_130301008 type="010">(.*)<\/ort\:_130301008>(?:.*)'.
|
||||
'<ort\:_130301012 type="010">(.*)<\/ort\:_130301012>(?:.*)'.
|
||||
'<ort\:_130301100 type="010">(.*)<\/ort\:_130301100>(?:.*)'.
|
||||
'<ort\:_130301102 type="010">(.*)<\/ort\:_130301102>(?:.*)'.
|
||||
'<ort\:_130302002 type="010">(.*)<\/ort\:_130302002>(?:.*)'.
|
||||
'<ort\:_130302003 type="010">(.*)<\/ort\:_130302003>(?:.*)'.
|
||||
'<ort\:_130302004 type="010">(.*)<\/ort\:_130302004>(?:.*)<\/ort\:_210>';
|
||||
$pregmatch=preg_match_all("/$strMatches/Uis", $strDir, $matchesDirs);
|
||||
foreach ($matchesDirs[1] as $i=>$dir) {
|
||||
$tabDir[$i]=array( 'Fonc'=>$dir[1],
|
||||
'Sexe'=>$dir[2],
|
||||
'Nom'=>$dir[3],
|
||||
'Prenom'=>$dir[4],
|
||||
'Prenom2'=>$dir[5],
|
||||
'NomJF'=>$dir[6],
|
||||
'NaissDept'=>$dir[7],
|
||||
'NaissLieu'=>$dir[8],
|
||||
'NaissNati'=>$dir[9],
|
||||
'NaissDate'=>$dir[10],
|
||||
'ReprNom'=>$dir[11],
|
||||
'ReprPrenom'=>$dir[12],
|
||||
'ReprPrenom2'=>$dir[13],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$fp=fopen(LOG_PATH.'/debugIdentiteRncs.log','a');
|
||||
fwrite($fp, print_r($matchesIden,true).PHP_EOL.print_r($matchesEtab,true).PHP_EOL.print_r($matchesDirs,true));
|
||||
fclose($fp);
|
||||
|
||||
return $tabIdentite;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,225 +0,0 @@
|
||||
<?php
|
||||
class Metier_Partenaires_MSigVille
|
||||
{
|
||||
private $client;
|
||||
|
||||
private $url='http://sig.ville.gouv.fr/recherche-adresses-zus-zfu-quartiers-des-cucs';
|
||||
private $referer='';
|
||||
private $codeRetour;
|
||||
private $page;
|
||||
private $body;
|
||||
private $cookie='';
|
||||
private $timeout=5;
|
||||
private $duree=false;
|
||||
|
||||
function __construct() {
|
||||
if ($this->cookie=='') {
|
||||
$tdeb=microtime(1);
|
||||
$this->page=getUrl($this->url, $this->cookie, '', $this->referer, false, 'sig.ville.gouv.fr', '', $this->timeout);
|
||||
$this->duree=round(microtime(1)-$tdeb,3);
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
$this->cookie=$this->header['Cookie'];
|
||||
if ($this->codeRetour<>200) return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getZonage($adrNum, $adrIndRep, $adrTypeVoie, $adrLibVoie, $cp, $ville='', $codeRivoli='', $rnvp=false, $raisonSociale='TEST', $debug=false) {
|
||||
if ($this->cookie<>'') {
|
||||
$tdeb=microtime(1);
|
||||
$post=array('insee_com'=>'01053',
|
||||
'code_postal'=>'01000',
|
||||
'nom_commune'=>'Bourg-en-Bresse',
|
||||
'num_adresse'=>'8',
|
||||
'id_voie'=>28,
|
||||
'nom_voie'=>'RUE+DES+BLANCHISSERIES',
|
||||
'x'=>33,
|
||||
'y'=>19,
|
||||
);
|
||||
$this->page=getUrl($this->url, $this->cookie, $post, $this->referer, false, 'sig.ville.gouv.fr', '', $this->timeout);
|
||||
$this->duree=round(microtime(1)-$tdeb,3);
|
||||
$this->referer=$this->url;
|
||||
$this->body=$page['body'];
|
||||
$this->codeRetour=$page['code'];
|
||||
$this->header=$page['header'];
|
||||
$this->cookie=$this->header['Cookie'];
|
||||
if ($this->codeRetour<>200) return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$tabRep=array();
|
||||
if (!$rnvp) {
|
||||
if ($cp<10000) $cp='0'.$cp;
|
||||
$dep2=substr($cp,0,2)*1;
|
||||
$dep3=substr($cp,0,3)*1;
|
||||
switch ($dep2) {
|
||||
case 0:
|
||||
case 5:
|
||||
case 9:
|
||||
case 15:
|
||||
case 19:
|
||||
case 23:
|
||||
case 32:
|
||||
case 46:
|
||||
case 48:
|
||||
case 82:
|
||||
case 97: // DOM
|
||||
case 98: // TOM
|
||||
case 99: // Etranger
|
||||
return $tabRep;
|
||||
break;
|
||||
default:
|
||||
//if ($dep3==975) return $tabRep;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$iDb=new WDB();
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$ret=$iDb->select( 'jo.zonage', 'zus, zru, zfu, cucs', "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
if (count($ret)>0) {
|
||||
$zones=$ret[0];
|
||||
$tabRep['ZUS']=$tabRep['ZFU']=$tabRep['ZRU']=$tabRep['CUCS']='NON';
|
||||
if (trim($zones['zus'])<>'') {
|
||||
if (trim($zones['zus'])=='NSP') $tabRep['ZUS']='NSP';
|
||||
else $tabRep['ZUS']='OUI';
|
||||
$tabRep['NZUS']=$zones['zus'];
|
||||
}
|
||||
if (trim($zones['zru'])<>'') {
|
||||
if (trim($zones['zru'])=='NSP') $tabRep['ZRU']='NSP';
|
||||
else $tabRep['ZRU']='OUI';
|
||||
$tabRep['NZRU']=$zones['zru'];
|
||||
}
|
||||
if (trim($zones['zfu'])<>'') {
|
||||
if (trim($zones['zfu'])=='NSP') $tabRep['ZFU']='NSP';
|
||||
else $tabRep['ZFU']='OUI';
|
||||
$tabRep['NZFU']=$zones['zfu'];
|
||||
}
|
||||
if (trim($zones['cucs'])<>'') {
|
||||
if (trim($zones['cucs'])=='NSP') $tabRep['CUCS']='NSP';
|
||||
else $tabRep['CUCS']='OUI';
|
||||
$tabRep['NCUCS']=$zones['cucs'];
|
||||
}
|
||||
//return $tabRep;
|
||||
} else {
|
||||
|
||||
try {
|
||||
if (trim($raisonSociale)=='') $raisonSociale='TEST'; // Le RNVP ne fonctionne pas sans la Raison Sociale qui est la 1ère ligne d'adresse
|
||||
$rep=$this->client->zonage( new SoapParam(strtr("$raisonSociale:$adresse:$cp:$ville",
|
||||
'¿°ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ??',
|
||||
' aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'),'adresse'),
|
||||
new SoapParam(':','separateur'),
|
||||
new SoapParam('type=M','options')
|
||||
);
|
||||
/*$rep=$this->client->zonage( "<adresse></adresse>".
|
||||
"<separateur>:</separateur>".
|
||||
"<options>type=M</options>");*/
|
||||
|
||||
/** Découpage des ZFU, CUCS etcs...
|
||||
**/
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - '.implode("\n", $rep)."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
|
||||
$tabZones=explode(',',$rep['zonage']); // ZUS=OUI,NZUS=1127020,ZFU=OUI,NZFU=11270ZF,CUCS=OUI,NCUCS=1127020
|
||||
foreach ($tabZones as $zone) {
|
||||
$tabTmp=explode('=',$zone);
|
||||
if (trim($tabTmp[0])<>'')
|
||||
$tabRep[$tabTmp[0]]=$tabTmp[1];
|
||||
}
|
||||
if ($tabRep['ZUS']=='NSP') $tabRep['NZUS']='NSP';
|
||||
if ($tabRep['ZRU']=='NSP') $tabRep['NZRU']='NSP';
|
||||
if ($tabRep['ZFU']=='NSP') $tabRep['NZFU']='NSP';
|
||||
if ($tabRep['CUCS']=='NSP') $tabRep['NCUCS']='NSP';
|
||||
$adresse=stripslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoie $adrLibVoie")));
|
||||
$ville=stripslashes($ville);
|
||||
$tabInsert=array( 'address'=>$adresse,
|
||||
'adr_cp'=>$cp,
|
||||
'adr_ville'=>$ville,
|
||||
'zus'=>$tabRep['NZUS'],
|
||||
'zru'=>$tabRep['NZRU'],
|
||||
'zfu'=>$tabRep['NZFU'],
|
||||
'cucs'=>$tabRep['NCUCS'],
|
||||
'adrNum'=>$adrNum,
|
||||
'adrIndRep'=>$adrIndRep,
|
||||
'adrTypeVoie'=>$adrTypeVoie,
|
||||
'adrLibVoie'=>$adrLibVoie,
|
||||
'rivoli'=>$codeRivoli,
|
||||
);
|
||||
$iDb->insert('jo.zonage', $tabInsert);
|
||||
|
||||
/** Autres Informations de la RNVP
|
||||
**/
|
||||
if ($rnvp || $debug) {
|
||||
$tabRepTmp=array();
|
||||
$tabZones=explode(',',$rep['objdesc']);
|
||||
foreach ($tabZones as $zone) {
|
||||
$tabTmp=explode('=',$zone);
|
||||
if (trim($tabTmp[0])<>'')
|
||||
$tabRepTmp[$tabTmp[0]]=$tabTmp[1];
|
||||
}
|
||||
if (!$debug) {
|
||||
$tabRep['ADR1']=@$tabRepTmp['ADR1'];
|
||||
$tabRep['ADR2']=@$tabRepTmp['ADR2'];
|
||||
$tabRep['ADR3']=@$tabRepTmp['ADR3'];
|
||||
$tabRep['ADR4']=@$tabRepTmp['ADR4'];
|
||||
$tabRep['ADR5']=@$tabRepTmp['ADR5'];
|
||||
$tabRep['ADR6']=@$tabRepTmp['ADR6'];
|
||||
$tabRep['ADR7']=@$tabRepTmp['ADR7'];
|
||||
} else {
|
||||
$tabRep=array_merge($tabRep, $tabRepTmp);
|
||||
}
|
||||
}
|
||||
} catch (SoapFault $fault) {
|
||||
echo 'ERREUR SOAP :'.PHP_EOL;
|
||||
print_r($fault);
|
||||
echo $this->client->__getLastRequest()."\n";
|
||||
echo $this->client->__getLastResponse()."\n";
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s').' - ERREUR SOAP : Requete = '.$this->client->__getLastRequest()."\n Reponse = ".$this->client->__getLastResponse()."\n============================================================================\n");
|
||||
fclose($fp);
|
||||
}
|
||||
//return $tabRep;
|
||||
}
|
||||
$codeInsee=substr($codeRivoli,0,5);
|
||||
$ret=$iDb->select( 'jo.zonageInsee', 'typeZone, arreteDate, decretDate, decretNum, decretModifieDate, decretModifieNum, dateDebut, dateFin', "codeInsee='$codeInsee'",false, MYSQL_ASSOC);
|
||||
$tabRep['ZRR']=$tabRep['AFR']='NON';
|
||||
foreach ($ret as $zones)
|
||||
switch ($zones['typeZone']) {
|
||||
case 'ZRR': $tabRep['ZRR']='OUI'; $tabRep['NZRR']=$codeInsee; break;
|
||||
case 'ZAFR': $tabRep['AFR']='OUI'; $tabRep['NAFR']=$codeInsee; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return $tabRep;
|
||||
}
|
||||
|
||||
function searchByTelFax($tel) {
|
||||
return $this->getTelFax('','','','',$tel);
|
||||
}
|
||||
|
||||
function getTelFax($nom, $cp, $ville='', $prenom='', $tel='') {
|
||||
if (trim($tel)<>'')
|
||||
$query="<telep>$tel</telep><scoremini>10</scoremini><distinction>30</distinction>";
|
||||
elseif (trim($prenom)=='')
|
||||
$query="<rs>$nom</rs><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
|
||||
else
|
||||
$query="<nom>$nom</nom><prenom>$prenom</prenom><cpville>$cp $ville</cpville><scoremini>90</scoremini><distinction>30</distinction>";
|
||||
|
||||
$rep=$this->client->rechtel($query);
|
||||
|
||||
$fp=fopen(LOG_PATH.'/amabis.log', 'a');
|
||||
fwrite($fp, date('d-m-Y H:i:s')." - $query - ".implode("\n", $rep)."\n============================================================================\n");
|
||||
fwrite($fp, "Requête : ".$this->client->__getLastRequest()."\n");
|
||||
fwrite($fp, "Réponse : ".$this->client->__getLastResponse()."\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user