2009-02-17 13:14:53 +00:00
< ?
2009-02-20 13:23:49 +00:00
include_once ( FWK_PATH . '/common/curl.php' );
2009-02-17 13:14:53 +00:00
class MIdentite {
public $body = '' ;
public $header = '' ;
public $codeRetour = 0 ;
function __construct ( $siren ) {
$referer = '' ;
$url = 'http://www.cofacerating.fr/portail/entreprise_identite/identite.asp?nsiren=' . $siren ;
$page = getUrl ( $url , '' , '' , $referer , false , 'www.cofacerating.fr' );
$this -> body = $page [ 'body' ];
$this -> codeRetour = $page [ 'code' ];
$this -> header = $page [ 'header' ];
$tabRet [ 'nscrl' ] =@ getTextInHtml ( $this -> body , '&nscrl=' , '=' , '&' );
$strTmp = 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>' , $strTmp );
$tabRet [ 'raisonSociale' ] = trim ( $tmp [ 0 ]);
unset ( $tmp [ 0 ]);
$tabRet [ 'adresse' ] = trim ( strip_tags ( implode ( ',' , $tmp )));
$tabRet [ 'tel' ] = trim ( @ getTextInHtml ( $this -> body , '<td bgcolor="#F3E5CC" class="tabligne"><b>T<> l<EFBFBD> phone<br>' , '<td bgcolor="#FFF3DE" class="tabval" valign="top">' , '<br>' ));
$tabRet [ 'fax' ] = trim ( @ getTextInHtml ( $this -> body , 'T<> l<EFBFBD> copie</b></td>' , '<br>' , '</td>' ));
$tabRet [ 'web' ] = trim ( @ getTextInHtml ( $this -> body , '><b>Adresse internet <br>' , '<a class="tabval" HREF="' , '" target="_new">' ));
$tabRet [ '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 );
$tabRet [ 'bourseIsin' ] = trim ( $tmp [ 0 ]);
$tabRet [ 'bourseMarche' ] = trim ( $tmp [ 1 ]);
$tabRet [ '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 <20> co.' ) $this -> infoEco = 'http://www.cofacerating.fr/portail/entreprise_identite/' . $matches [ 1 ];
elseif ( substr ( $matches [ 2 ], 0 , 6 ) == 'bilan ' ) $this -> tabBilans [] = substr ( $matches [ 2 ], 6 , strlen ( $matches [ 2 ]) - 6 );
} */
$tabRet [ '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<6C> code activit<69> </b></td>' , '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval">' , '</td>' )))));
$tabRet [ 'naf' ] = trim ( @ getTextInHtml ( $this -> body , '<a href="../chaineeco_dynaeco/DynaEco.asp?cnaf=' , 'cnaf=' , '&' ));
$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' ];
$tabRet [ '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 ;
}
*/
$tabRet [ 'effectif' ] = trim ( @ getTextInHtml ( $pou , '<tr><td class="ligne1_2">Effectifs</td>' , '<td class="ligne2_2">' , '</td></tr>' ));
$strTmp = trim ( @ getTextInHtml ( $pou , '<tr><td class="ligne1_2">Date d\'immatriculation</td>' , '<td class="ligne2_2">' , '</td></tr>' ));
if ( strlen ( $strTmp ) == 4 )
$strTmp = '01/01/' . $strTmp ;
elseif ( strlen ( $strTmp ) == 7 )
$strTmp = '01/' . $strTmp ;
$tabRet [ 'dateImmatriculation' ] = WDate :: dateT ( 'd/m/Y' , 'Y-m-d' , $strTmp );
$strTmp = trim ( @ getTextInHtml ( $pou , '<tr><td class="ligne1_2">Date de fin d\'exploitation</td>' , '<td class="ligne2_2">' , '</td></tr>' ));
if ( strlen ( $strTmp ) == 4 )
$strTmp = '01/01/' . $strTmp ;
elseif ( strlen ( $strTmp ) == 7 )
$strTmp = '01/' . $strTmp ;
$tabRet [ 'dateFermeture' ] = WDate :: dateT ( 'd/m/Y' , 'Y-m-d' , $strTmp );
if ( $tabRet [ 'tel' ] == '' || $tabRet [ 'tel' ] == '0' )
$tabRet [ 'tel' ] = trim ( @ getTextInHtml ( $pou , '<tr><td class="ligne1_2">T<> l<EFBFBD> phone</td>' , '<td class="ligne2_2">' , '</td></tr>' ));
if ( $tabRet [ 'fax' ] == '' || $tabRet [ 'fax' ] == '0' )
$tabRet [ 'fax' ] = trim ( @ getTextInHtml ( $pou , '<tr><td class="ligne1_2">Fax</td>' , '<td class="ligne2_2">' , '</td></tr>' ));
$strTmp = trim ( @ getTextInHtml ( $pou , '<tr><td class="ligne1_2">Activit<69> principale</td>' , '<td class="ligne2_2">' , '</td></tr>' ));
$tabRet [ 'nafLib' ] = trim ( strtr ( substr ( $strTmp , 0 , strlen ( $strTmp ) - 6 ), '()' , ' ' ));
if ( $tabRet [ 'naf' ] == '' )
$tabRet [ 'naf' ] = trim ( strtr ( substr ( $strTmp , - 6 ), '()' , ' ' ));
$strTmp = trim ( @ getTextInHtml ( $pou , '<tr><td class="ligne1_2">Chiffre d\'affaires</td>' , '<td class="ligne2_2">' , '</td></tr>' ));
$tabRet [ 'tca' ] = $strTmp ;
$tabRet [ 'score_pouey' ] = trim ( @ getTextInHtml ( $pou , '<param name="movie" value="cadran.swf?rotation=' , '&type=pouey&valeur=' , '">' ));
$tabRet [ 'score_conan' ] = trim ( @ getTextInHtml ( $pou , '<param name="movie" value="cadran.swf?rotation=' , '&type=ch&valeur=' , '">' ));
$tabRet [ 'score_afdcc' ] = trim ( @ getTextInHtml ( $pou , '<param name="movie" value="cadran.swf?rotation=' , '&type=afdcc&valeur=' , '">' ));
$tabRet [ 'vigilance' ] = trim ( @ getTextInHtml ( $pou , '<param name="movie" value="vigilance.swf' , 'degre=' , '">' ));
if ( $this -> codeRetour == 200 )
return true ;
return false ;
}
}
?>