2010-11-04 11:05:01 +00:00
< ?
class Insee {
}
function getDataEtablissement ( $pageHtml )
{
global $libelleErreur ;
$responseSiege = $pageHtml ;
$tabRet = array ();
2010-11-29 14:17:26 +00:00
// On recherche si on est sur un <20> tablissement si<73> ge ou secondaire
2010-11-04 11:05:01 +00:00
$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' ;
2010-11-29 14:17:26 +00:00
$pos = strpos ( $pageHtml , '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche si<73> ge</B>' );
2010-11-04 11:05:01 +00:00
if ( $pos > 0 )
2010-11-29 14:17:26 +00:00
$tabRet [ 'typeEtablissement' ] = 'si<73> ge' ;
2010-11-04 11:05:01 +00:00
2010-11-29 14:17:26 +00:00
// Recherche Derni<6E> re MAJ / Activit<69>
$pos = strpos ( $responseSiege , '<font face="Arial" size="2">(derni<6E> re mise <20> jour :' );
2010-11-04 11:05:01 +00:00
if ( $pos > 0 ) {
$tabRet [ 'dateMAJ' ] = substr ( $responseSiege , $pos + 51 , 10 );
$tabRet [ 'dateAbsActivite' ] = '' ;
$tabRet [ 'active' ] = 'O' ;
} else {
$tabRet [ 'active' ] = 'N' ;
$tabRet [ 'dateMAJ' ] = '' ;
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseSiege , '<font face="Arial" size="2">Absence d\'activit<69> not<6F> e le : ' );
2010-11-04 11:05:01 +00:00
if ( $pos > 0 ) $tabRet [ 'dateAbsActivite' ] = substr ( $responseSiege , $pos + 78 , 10 );
else {
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseSiege , '<font face="Arial" size="2">Absence d\'activit<69> ' );
2010-11-04 11:05:01 +00:00
if ( $pos > 0 ) $tabRet [ 'dateAbsActivite' ] = '' ;
}
}
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseSiege , ' size="-1"> <B>n<> SIRET :</B></FONT></td><td valign="top"><font face="Arial" size="-1">' );
$tabRet [ 'siret' ] = str_replace ( '<27> ' , '' , html_entity_decode ( substr ( $responseSiege , $pos + 97 , 32 )));
2010-11-04 11:05:01 +00:00
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseSiege , 'size="-1"> <B>Date de cr<63> ation :</B></FONT></td><td valign="top"><font face="Arial" size="-1">' );
2010-11-04 11:05:01 +00:00
if ( $pos > 0 ) {
$posFin = strpos ( $responseSiege , '</font>' , $pos + 109 );
2010-11-29 14:17:26 +00:00
$tabRet [ 'dateCreation' ] = str_replace ( '<27> ' , '' , html_entity_decode ( substr ( $responseSiege , $pos + 109 , $posFin - ( $pos + 109 ))));
2010-11-04 11:05:01 +00:00
}
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 );
2010-11-29 14:17:26 +00:00
$tabRet [ 'raisonSociale' ] = trim ( str_replace ( '<27> ' , '' , html_entity_decode ( $raisonSocialeTabLigne [ 0 ])));
$tabRet [ 'Enseigne' ] = trim ( str_replace ( '<27> ' , '' , html_entity_decode ( $raisonSocialeTabLigne [ 1 ])));
2010-11-04 11:05:01 +00:00
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseSiege , ' size="-1"> <B>Activit<69> principale :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">' );
2010-11-04 11:05:01 +00:00
$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 ];
*/
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseSiege , '<font face="Arial" size="-1"><b>L\'entreprise est connue au r<> pertoire comme ' );
2010-11-04 11:05:01 +00:00
if ( $pos > 0 ) {
$posFin = strpos ( $responseSiege , '</b>' , $pos + 106 );
$tabRet [ 'etatJuridique' ] = html_entity_decode ( substr ( $responseSiege , $pos + 106 , $posFin - ( $pos + 106 )));
$tabRet [ 'dateEtatJuridique' ] = '' ;
} else {
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseSiege , '<font face="Arial" size="-1"><b>L\'entreprise est cess<73> e le : ' );
2010-11-04 11:05:01 +00:00
$tabRet [ 'dateEtatJuridique' ] = substr ( $responseSiege , $pos + 86 , 10 );
2010-11-29 14:17:26 +00:00
$tabRet [ 'etatJuridique' ] = 'cess<73> e' ;
2010-11-04 11:05:01 +00:00
}
//echo 'GetDataEtab="'.$libelleErreur."\"\r\n";
return $tabRet ;
}
}
function getDataEntreprise ( $pageHtml )
{
global $libelleErreur ;
$responseEntreprise = $pageHtml ;
$tabRet = array ();
if ( $libelleErreur == '' ) {
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseEntreprise , 'size="-1"> <B>Date de cr<63> ation :</B></FONT></td><td valign="top"><font face="Arial" size="-1">' );
2010-11-04 11:05:01 +00:00
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 );
2010-11-29 14:17:26 +00:00
$tabRet [ 'raisonSocialeEntrep' ] = trim ( str_replace ( '<27> ' , '' , html_entity_decode ( $raisonSocialeTabLigne [ 0 ])));
$tabRet [ 'sigle' ] = trim ( str_replace ( '<27> ' , '' , html_entity_decode ( $raisonSocialeTabLigne [ 1 ])));
2010-11-04 11:05:01 +00:00
2010-11-29 14:17:26 +00:00
// Activit<69> prinicpale Entrep
$pos = strpos ( $responseEntreprise , ' size="-1"> <B>Activit<69> principale :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">' );
2010-11-04 11:05:01 +00:00
$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
2010-11-29 14:17:26 +00:00
$pos = strpos ( $responseEntreprise , ' size="-1"> <B>Nb <3B> tablissements actifs :</B></FONT></td><td valign="top"><font face="Arial" size="-1">' );
2010-11-04 11:05:01 +00:00
$posFin = strpos ( $responseEntreprise , '</font>' , $pos + 118 );
2010-11-29 14:17:26 +00:00
$tabRet [ 'nbEtabActifs' ] = trim ( str_replace ( '<27> ' , '' , html_entity_decode ( substr ( $responseEntreprise , $pos + 118 , $posFin - ( $pos + 118 )))));
2010-11-04 11:05:01 +00:00
}
return $tabRet ;
}
/*
* parseHtml . php
* Author : Carlos Costa Jordao
* Email : carlosjordao @ yahoo . com
*
* My notation of variables :
* i_ = integer , ex : i_count
* a_ = array , a_html
* b_ = boolean ,
* s_ = string
*
* What it does :
* - parses a html string and get the tags
* - exceptions : html tags like < br > < hr > </ a > , etc
* - At the end , the array will look like this :
* [ " IMG " ][ 0 ][ " SRC " ] = " xxx "
* [ " IMG " ][ 1 ][ " SRC " ] = " xxx "
* [ " IMG " ][ 1 ][ " ALT " ] = " xxx "
* [ " A " ][ 0 ][ " HREF " ] = " xxx "
*
*/
function parseHtml ( $s_str )
{
$i_indicatorL = 0 ;
$i_indicatorR = 0 ;
$s_tagOption = '' ;
$i_arrayCounter = 0 ;
$a_html = array ();
// Search for a tag in string
while ( is_int (( $i_indicatorL = strpos ( $s_str , '<' , $i_indicatorR ))) ) {
// Get everything into tag...
$i_indicatorL ++ ;
$i_indicatorR = strpos ( $s_str , '>' , $i_indicatorL );
$s_temp = substr ( $s_str , $i_indicatorL , ( $i_indicatorR - $i_indicatorL ) );
$a_tag = explode ( ' ' , $s_temp );
// Here we get the tag's name
list ( , $s_tagName ,, ) = each ( $a_tag );
$s_tagName = strtoupper ( $s_tagName );
// Well, I am not interesting in <br>, </font> or anything else like that...
// So, this is false for tags without options.
$b_boolOptions = is_array (( $s_tagOption = each ( $a_tag ))) && $s_tagOption [ 1 ];
if ( $b_boolOptions ) {
// Without this, we will mess up the array
$i_arrayCounter = ( int ) count ( $a_html [ $s_tagName ]);
// get the tag options, like src="htt://". Here, s_tagTokOption is 'src' and s_tagTokValue is '"http://"'
do {
$s_tagTokOption = strtoupper ( strtok ( $s_tagOption [ 1 ], " = " ));
$s_tagTokValue = trim ( strtok ( " = " ));
$a_html [ $s_tagName ][ $i_arrayCounter ][ $s_tagTokOption ] =
$s_tagTokValue ;
$b_boolOptions = is_array (( $s_tagOption = each ( $a_tag ))) &&
$s_tagOption [ 1 ];
} while ( $b_boolOptions );
}
}
return $a_html ;
}
function getDataEntrepriseRNCS ( $pageHtml ) {
global $libelleErreur ;
$tabRet = array ();
// Liste et liens vers les Bilans
$tabRet [ 'tabListeBilans' ] = getTabListeBilans ( $pageHtml );
$tabRet [ 'raisonSociale' ] = getTextInHtml ( $pageHtml , '<td align="left" valign="top"><span class="boldred"><br>' , '<br>' , '</span>' );
$tabRet [ 'RCS' ] = getTextInHtml ( $pageHtml , '<span class="textarial">RCS ' , 'RCS ' , '</span>' , true );
$tabRet [ 'activite' ] = getTextInHtml ( $pageHtml , '<td width="185" align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Activité</td>' , 'class="basictext">' , '</td>' );
$tabRet [ 'adresseSiege' ] = getTextInHtml ( $pageHtml , ' < td align = " left " valign = " top " bgcolor = " #FFFFFF " class = " boldtextarial " > Si & egrave ; ge
social </ td > ', ' class = " basictext " > ', ' </ td > ' );
print_r ( $tabRet );
die ();
// Capital social
// Chiffre d'affaires
// Date CA
// Effectif
// Forme Juridique
2010-11-29 14:17:26 +00:00
// Nationalit<69>
2010-11-04 11:05:01 +00:00
2010-11-29 14:17:26 +00:00
// Activit<69>
2010-11-04 11:05:01 +00:00
2010-11-29 14:17:26 +00:00
// Si<53> ge social
2010-11-04 11:05:01 +00:00
/*
< tr >
< td bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td align = " left " valign = " top " bgcolor = " #FFFFFF " class = " boldtextarial " > Si & egrave ; ge
social </ td >
< td bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td align = " left " valign = " top " bgcolor = " #EBF0F5 " class = " basictext " > 75 Avenue la Grande Armee < br >
75116 PARIS 16 </ td >
</ tr >
</ table >
< div align = " center " >< img src = " ../images/degrade580grey.jpg " width = " 580 " height = " 12 " >< br >
< br >
</ div >
< table width = " 600 " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " >
< tr >
< td align = " left " valign = " top " >< img src = " ../images/arrowsmallblue.gif " width = " 9 " height = " 10 " >< span class = " boldtextarialblue15 " > Renseignements
juridiques </ span ></ td >
< td >& nbsp ; </ td >
</ tr >
</ table >
< table width = " 580 " border = " 0 " align = " center " cellpadding = " 1 " cellspacing = " 2 " >
< tr align = " left " valign = " top " >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td width = " 185 " bgcolor = " #FFFFFF " class = " boldtextarial " > Forme
juridique </ td >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
2010-11-29 14:17:26 +00:00
< td width = " 385 " bgcolor = " #EBF0F5 " class = " basictext " > SA <EFBFBD> conseil d ' administration </ td >
2010-11-04 11:05:01 +00:00
</ tr >
< tr align = " left " valign = " top " >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td width = " 185 " bgcolor = " #FFFFFF " class = " boldtextarial " > Capital social </ td >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td width = " 385 " bgcolor = " #EBF0F5 " class = " basictext " > 171.285 . 000 , 00
EURO </ td >
</ tr >
< tr align = " left " valign = " top " >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td width = " 185 " bgcolor = " #FFFFFF " class = " boldtextarial " > Nationalit & eacute ; </ td >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td bgcolor = " #EBF0F5 " class = " basictext " > France </ td >
</ tr >
</ table >
< div align = " center " >< img src = " ../images/degrade580grey.jpg " width = " 580 " height = " 12 " >< br >
< br >
</ div >
< div align = " center " >
< table width = " 588 " border = " 0 " cellpadding = " 0 " cellspacing = " 0 " >
< tr >
< td width = " 210 " align = " left " valign = " top " >< img src = " ../images/arrowsmallblue.gif " width = " 9 " height = " 10 " >< span class = " boldtextarialblue15 " > Chiffres
cl & eacute ; s </ span ></ td >
< td width = " 378 " align = " left " valign = " top " class = " smalltext " > au 31 - 12 - 2004 </ td >
</ tr >
</ table >
< table width = " 580 " border = " 0 " align = " center " cellpadding = " 1 " cellspacing = " 2 " >
< tr >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td width = " 185 " align = " left " valign = " top " bgcolor = " #FFFFFF " class = " boldtextarial " > Chiffre
d ' affaires </ td >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td width = " 385 " align = " left " valign = " top " bgcolor = " #EBF0F5 " class = " basictext " > 18.049 . 000.000
EU </ td >
</ tr >
< tr >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
< td width = " 185 " align = " left " valign = " top " bgcolor = " #FFFFFF " class = " boldtextarial " > Effectif </ td >
< td width = " 5 " bgcolor = " #336699 " >< img src = " ../images/shim.gif " width = " 2 " height = " 2 " ></ td >
2010-11-29 14:17:26 +00:00
< td width = " 385 " align = " left " valign = " top " bgcolor = " #EBF0F5 " class = " basictext " > De 5150 <EFBFBD> 5720 </ td >
2010-11-04 11:05:01 +00:00
</ tr >
</ table >
< div align = " center " >< img src = " ../images/degrade580grey.jpg " width = " 580 " height = " 12 " >< br >
< br >
< br >
</ div >
</ div >
< table width = " 600 " border = " 0 " cellspacing = " 2 " cellpadding = " 0 " >*/
return $tabRet ;
}
function getDataEcoCoface ( $pageHtml ) {
global $libelleErreur ;
$tabRet = array ();
// SIREN
2010-11-29 14:17:26 +00:00
$pos = strpos ( $pageHtml , '<b><font class="nota">La forme juridique ou la date de cr<63> ation trop r<> cente de l\'entreprise ne nous permettant pas d\'obtenir suffisamment d\'informations, nous vous offrons ce produit.</font></b>' );
2010-11-04 11:05:01 +00:00
if ( $pos > 0 ) {
$tabRet [ 'infoEco' ] = 'OUI' ;
2010-11-29 14:17:26 +00:00
$tabRet [ 'societeInactive' ] =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Soci<63> t<EFBFBD> inactive</td>' , '<td bgcolor="#FFF3DE" class="tabval" > ' , '</td>' );
2010-11-04 11:05:01 +00:00
$strCapital =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Capital   (' , '(' , '</tr><tr>' );
$tabTmp = explode ( '</td>' , $strCapital );
$tabRet [ 'capital_source' ] = str_replace ( ')' , '' , $tabTmp [ 0 ]);
$tabTmp = explode ( ' ' , $tabTmp [ 1 ]);
$tabRet [ 'capital_montant' ] = str_replace ( chr ( 160 ), '' , trim ( strip_tags ( $tabTmp [ 0 ])));
$tabRet [ 'capital_devise' ] = trim ( strip_tags ( $tabTmp [ 1 ]));
2010-11-29 14:17:26 +00:00
$tabRet [ 'dateCreation' ] =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Date de cr<63> ation</td>' , '<td bgcolor="#FFF3DE" class="tabval" > ' , '</td>' );
2010-11-04 11:05:01 +00:00
$tabRet [ 'formeJuridique' ] =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Forme juridique</td>' , '<td bgcolor="#FFF3DE" class="tabval" > ' , '</td>' );
$tabRet [ 'cotationBourse' ] =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Cotation en bourse</td>' , '<td bgcolor="#FFF3DE" class="tabval" > ' , '</td>' );
2010-11-29 14:17:26 +00:00
$tabRet [ 'effectifSociete' ] =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Effectif soci<63> t<EFBFBD> </td>' , '<td bgcolor="#FFF3DE" class="tabval" > ' , '</td>' );
$tabRet [ 'activite' ] =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Activit<69> </td>' , '<td bgcolor="#FFF3DE" class="tabval" > ' , '</td>' );
2010-11-04 11:05:01 +00:00
$tabRet [ 'sigle' ] =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Sigle</td>' , '<td bgcolor="#FFF3DE" class="tabval" > ' , '</td>' );
$tabRet [ 'enseigne' ] =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne" > Enseigne</td>' , '<td bgcolor="#FFF3DE" class="tabval" > ' , '</td>' );
// Dirigeants
$strDir =@ getTextInHtml ( $pageHtml , '<td class="tabtot">IDENTITE</td>' , '<td> </td>' , '</table>' );
$tabDir = explode ( '</tr>' , $strDir );
$nbDir = 1 ;
foreach ( $tabDir as $key => $dir )
{
$tabTmp = explode ( '<td bgcolor="#FFF3DE" class="tabval" > ' , $dir );
$typeDir = trim ( strip_tags ( $tabTmp [ 0 ]));
$nomDir = trim ( strip_tags ( $tabTmp [ 1 ]));
2010-11-29 14:17:26 +00:00
if ( $typeDir <> '' && $typeDir <> 'Date de cr<63> ation' && $typeDir <> 'Forme juridique' && $typeDir <> 'Cotation en bourse'
&& $typeDir <> 'Effectif soci<63> t<EFBFBD> ' && $typeDir <> 'Soci<63> t<EFBFBD> inactive' && $typeDir <> 'Activit<69> '
2010-11-04 11:05:01 +00:00
&& $typeDir <> 'Sigle' && $typeDir <> 'Enseigne'
&& substr ( $typeDir , 0 , 8 ) <> 'Capital ' )
{
//$tabDir['Produits'].=$produit.'/';
//$produit=str_replace(' ','_',$produit);
$tabRet [ 'Dirigeant' . $nbDir . 'Type' ] = trim ( $typeDir );
$tabTmp = explode ( ' ' , $nomDir );
$tabRet [ 'Dirigeant' . $nbDir . 'Genre' ] = trim ( $tabTmp [ 0 ]);
$tabRet [ 'Dirigeant' . $nbDir . 'Prenom' ] = trim ( $tabTmp [ 1 ]);
$tabRet [ 'Dirigeant' . $nbDir . 'Nom' ] = trim ( $tabTmp [ 2 ]);
$nbDir ++ ;
}
}
$tabRet [ 'NbDirigeants' ] = $nbDir - 1 ;
// Liens Financiers
$strTmp =@ getTextInHtml ( $pageHtml , '<td class="tabtot">LIENS FINANCIERS</td>' , '<td> </td>' , '</table>' );
2010-11-29 14:17:26 +00:00
if ( strpos ( $strTmp , 'N<> ant' ) > 0 )
$tabRet [ 'LiensFinanciers' ] = 'N<> ant' ;
2010-11-04 11:05:01 +00:00
else
2010-11-29 14:17:26 +00:00
$tabRet [ 'LiensFinanciers' ] = 'Pr<50> sence liens' ;
2010-11-04 11:05:01 +00:00
// ELEMENTS FINANCIERS
$strTmp =@ getTextInHtml ( $pageHtml , '<td class="tabtot">ELEMENTS FINANCIERS</td>' , '<td> </td>' , '</table>' );
2010-11-29 14:17:26 +00:00
if ( strpos ( $strTmp , 'N<> ant' ) > 0 )
$tabRet [ 'ElementsFinanciers' ] = 'N<> ant' ;
2010-11-04 11:05:01 +00:00
else
2010-11-29 14:17:26 +00:00
$tabRet [ 'ElementsFinanciers' ] = 'Pr<50> sence El.Fi.' ;
2010-11-04 11:05:01 +00:00
}
else
$tabRet [ 'infoEco' ] = 'NON' ;
//echo $pageHtml;
//print_r($tabRet);
//die();
return $tabRet ;
}
function getDataEntrepriseCoface ( $pageHtml ) {
global $libelleErreur ;
$tabRet = array ();
// SIREN
$tabRet [ 'siren' ] =@ getTextInHtml ( $pageHtml , 'portail/entreprise_identite/identite.asp?nsiren=' , '?nsiren=' , '&IMPRESSION=OUI' );
//$tabRet['siren']=@getTextInHtml($pageHtml, '<a href="http://www.coface.fr" target="_blank"> Qui sommes nous </a>-<a href="javascript:;" onClick="MM_openBrWindow(\'../mod_cofacescrl/part_recherche.asp?nscrl=18452&metier=ALL&geo=ALL&idnav=168d25840396c5f38f4
$tabRet [ 'nscrl' ] =@ getTextInHtml ( $pageHtml , 'Plan du site </a>-<a href="http://www.coface.fr" target="_blank"> Qui sommes nous </a>-<a href="javascript:;" onClick="MM_openBrWindow(\'../mod_cofacescrl/part_recherche.asp?nscrl=' , '?nscrl=' , '&metier=ALL&geo=ALL&idnav=' );
2010-11-29 14:17:26 +00:00
// Raison Sociale, Adresse et lien vers G<> oloc
2010-11-04 11:05:01 +00:00
$strRS_Adr =@ getTextInHtml ( $pageHtml , '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne"> <b> Raison sociale<br>' , '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><b>' , '</b></td>' );
$tabRS_Adr = explode ( '<br>' , $strRS_Adr );
$tabRet [ 'raisonSociale' ] = trim ( $tabRS_Adr [ 0 ]);
$tabRS_Adr1 = explode ( ' ' , $tabRS_Adr [ 1 ]);
$tabRet [ 'AdresseLigne1' ] = trim ( $tabRS_Adr1 [ 0 ]);
$tabRet [ 'AdresseLigne2' ] = trim ( $tabRS_Adr1 [ 1 ]);
$tabRS_Adr1 = explode ( ' ' , $tabRS_Adr [ 2 ]);
$tabRet [ 'codePostal' ] = trim ( $tabRS_Adr1 [ 0 ]);
$tabRet [ 'ville' ] = trim ( $tabRS_Adr1 [ 1 ]);
$tabRet [ 'UrlGeoLoc' ] =@ getTextInHtml ( $pageHtml , '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><a href="javascript:;" onClick="MM_openBrWindow(\'' , 'onClick="MM_openBrWindow(\'' , '\',\'Planfax' );
2010-11-29 14:17:26 +00:00
// T<> l<EFBFBD> phone / Fax
$strTelFax =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne"><b>T<> l<EFBFBD> phone<br>' , '<td bgcolor="#FFF3DE" class="tabval" valign="top">' , '</td>' );
2010-11-04 11:05:01 +00:00
$tabTelFax = explode ( '<br>' , $strTelFax );
$tabRet [ 'tel' ] = trim ( $tabTelFax [ 0 ]);
$tabRet [ 'fax' ] = trim ( $tabTelFax [ 1 ]);
// Adresse Internet / Email
$strInet =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne"><b>Adresse internet <br>' , '<td bgcolor="#FFF3DE" class="tabval"><a class="tabval" HREF="' , '</a></td>' );
$tabInet = explode ( '<br>' , $strInet );
$tabRet [ 'web' ] = trim ( @ getTextInHtml ( $tabInet [ 0 ], ' target="_new">' , '>' , '</a>' ) );
$tabRet [ 'mail' ] = trim ( @ getTextInHtml ( $tabInet [ 1 ], ' href="mailto:' , ':' , '">' ) );
// Bourse
$strBourse =@ getTextInHtml ( $pageHtml , '<td bgcolor="#F3E5CC" class="tabligne"> <b>' . " \r \n " . ' Code Sicovam<br>' , '<td bgcolor="#FFF3DE" class="tabval">' , '</td>' );
$tabBourse = explode ( '<br>' , $strBourse );
$tabRet [ 'bourse_isin' ] = trim ( $tabBourse [ 0 ]);
$tabRet [ 'bourse_marche' ] = trim ( $tabBourse [ 1 ]);
$tabRet [ 'bourse_ville' ] = trim ( $tabBourse [ 2 ]);
2010-11-29 14:17:26 +00:00
// Activit<69>
$tabRet [ 'activite' ] = trim ( str_replace ( ' ' , ' ' , @ getTextInHtml ( $pageHtml , '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne" valign="top"><b>Libell<6C> code activit<69> </b></td>' , '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval">' , '</td>' )));
2010-11-04 11:05:01 +00:00
// Produits disponibles
$strDispos =@ getTextInHtml ( $pageHtml , '<table border="0" cellpadding="0" cellspacing="0" width="98%"><tr><td class="normal"><b>Produits disponibles</b></td></tr><tr><td bgcolor="#E1D0B6"><img src="../images/vide.gif" border="0" height="1"><br></td></tr><tr><td><img src="../images/vide.gif" border="0" height="5"><br></td></tr></table>' , '<table border="0" cellpadding="5" cellspacing="0" width="100%">' , '</table>' );
$tabDispos = explode ( '<td align="left" width="25%"' , $strDispos );
$tabRet [ 'Produits' ] = '' ;
foreach ( $tabDispos as $key => $produit )
{
$produit = trim ( str_replace ( '>' , '' , str_replace ( 'nowrap>' , '' , strip_tags ( $produit ))));
if ( $produit <> '' && $produit <> ' ' ) {
$tabRet [ 'Produits' ] .= $produit . '/' ;
$produit = str_replace ( ' ' , '_' , $produit );
$tabRet [ 'Produit_' . $produit ] = 'Oui' ;
}
}
// print_r($tabRet);
// die();
return $tabRet ;
}
function getTabListeBilans ( $pageHtml ) {
$tabUrl = array ();
$deb = $fin = 0 ;
while ( is_int (( $deb = strpos ( $pageHtml , '<a href="http://www.societe.com/cgi-bin/bilan?bil=' , $fin ))) ) {
$deb = $deb + 9 ;
$fin = strpos ( $pageHtml , '</a>' , $deb );
$s_temp = substr ( $pageHtml , $deb , ( $fin - $deb ));
//echo $s_temp."\r\n";
$a_temp = explode ( '" class="basic">' , $s_temp );
$tabUrl [ $a_temp [ 1 ]] = $a_temp [ 0 ];
}
return $tabUrl ;
}
function getTabListeGU ( $pageHtml ) {
$tabGU = array ();
$deb = $fin = 0 ;
/* < tr >< td >< img alt = " " src = " b.gi onMouseOver= " javascript : mOvr ( this ); " onMouseOut= " javascript : mOut ( this ); " ><a class=txt9px href= " javascript : ChoixGeo ( 'CP_PDR_SUP_LOC_REQ' ) " >Lancer la recherche dans toute la localité</td></tr>
< tr >< td >< img src = " b.gif " alt = " " border = 0 ></ td >< td align = " left " onMouseOver = " javascript:mOvr(this); " onMouseOut = " javascript:mOut(this); " >< a class = txt9px href = " javascript:ChoixGeo('CP_INSCRIPTIONS_REQ') " > Lancer la recherche sans l & #39;adresse</td></tr>
*/
while ( is_int (( $deb = strpos ( $pageHtml , '<td onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class="txt9px" href="javascript:ChoixGeo(\'' , $fin ))) ) {
$deb = $deb + 122 ;
$fin = strpos ( $pageHtml , '</td></tr>' , $deb );
$s_temp = substr ( $pageHtml , $deb , ( $fin - $deb ));
//echo $s_temp."\r\n";
$a_temp = explode ( '\')">' , $s_temp );
$tabGU [ $a_temp [ 1 ]] = $a_temp [ 0 ];
}
return $tabGU ;
}
function getTabListeNonTrouve ( $pageHtml ) {
$tabGU = array ();
$deb = $fin = 0 ;
/* onMouseOver = " javascript:mOvr(this); " onMouseOut = " javascript:mOut(this); " >< a class = txt9px href = " javascript:ChoixGeo('CP_PDR_SUP_LOC_REQ') " > Lancer la recherche dans toute la localit & eacute ; </ td ></ tr >
onMouseOver = " javascript:mOvr(this); " onMouseOut = " javascript:mOut(this); " >< a class = txt9px href = " javascript:ChoixGeo('CP_INSCRIPTIONS_REQ') " > Lancer la recherche sans l & #39;adresse</td></tr>
*/
while ( is_int (( $deb = strpos ( $pageHtml , 'onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo(\'' , $fin ))) ) {
$deb = $deb + 116 ;
$fin = strpos ( $pageHtml , '</td></tr>' , $deb );
$s_temp = substr ( $pageHtml , $deb , ( $fin - $deb ));
//echo $s_temp."\r\n";
$a_temp = explode ( '\')">' , $s_temp );
$tabGU [ $a_temp [ 1 ]] = $a_temp [ 0 ];
}
return $tabGU ;
}
/** Recherche un texte dans une page HTML
**
**/
function getTextInHtml ( $pageHtml , $strToFind , $strDeb , $strEnd , $include_strDeb = false , $include_strEnd = false , $ltrim = true , $rtrim = true , & $fin , $nbOcc = 1 ) {
$tabRet = array ();
$deb = $nbOccTrouve = 0 ;
while ( is_int (( $deb = strpos ( $pageHtml , $strToFind , $fin ))) ) {
$deb ++ ;
$deb2 = strpos ( $pageHtml , $strDeb , $deb );
$fin = strpos ( $pageHtml , $strEnd , $deb2 );
if ( ! $include_strDeb )
$deb2 += strlen ( $strDeb );
$s_temp = substr ( $pageHtml , $deb2 , ( $fin - $deb2 ));
if ( $ltrim ) $s_temp = ltrim ( $s_temp );
if ( $rtrim ) $s_temp = rtrim ( $s_temp );
if ( $nbOcc == 1 ) return $s_temp ;
//echo $s_temp."\r\n";
//$a_temp = explode('" class="basic">', $s_temp);
$tabUrl [ $nbOccTrouve ] = $s_temp ;
$nbOccTrouve ++ ;
if ( $nbOcc == $nbOccTrouve ) {
2010-11-29 14:17:26 +00:00
// echo "j'ai trouv<75> le nb demand<6E> , je sort\r\n";
2010-11-04 11:05:01 +00:00
break ;
};
}
return $tabUrl ;
/*< span class = " mongrasvert " >
2010-11-29 14:17:26 +00:00
< li > Le type de voie a <EFBFBD> t<EFBFBD> modifi<EFBFBD> < br >
< li > L ' orthographe du mot directeur a <EFBFBD> t<EFBFBD> modifi<EFBFBD> e < br >
< li > Le code postal a <EFBFBD> t<EFBFBD> forc<EFBFBD> <EFBFBD> partir du d<EFBFBD> partement et de la localit<EFBFBD> < br > </ span >
2010-11-04 11:05:01 +00:00
*/
}
?>