69 lines
2.9 KiB
PHP
69 lines
2.9 KiB
PHP
#!/usr/bin/php -c/var/www/batch/config/php_batch_sd.ini
|
|
<?php
|
|
|
|
include_once(FWK_PATH.'common/curl.php');
|
|
|
|
$referer='http://www.huissier-justice.fr/annuaire.aspx?id=143';
|
|
$iDb=new WDB();
|
|
|
|
for ($dep=36; $dep<975; $dep++) {// 1
|
|
if ($dep<10) $dep='00'.$dep;
|
|
elseif ($dep<96) $dep='0'.$dep;
|
|
elseif ($dep<970) continue;
|
|
|
|
for ($num=1; true; $num++) {
|
|
if ($num<10) $num='0'.$num;
|
|
$url='http://www.huissier-justice.fr/annuaire/tinst.asp?ti='.$dep.$num;
|
|
//echo "$url\n";
|
|
$page=getUrl($url, '', '', $referer, false, 'www.huissier-justice.fr');
|
|
$body=$page['body'];
|
|
//echo "$body\n====================================================================================================================\n";
|
|
if (strpos($body, "<td bgcolor=#A2BBB3 class=text12GBL colspan=3> </td>")==0)
|
|
{
|
|
if(preg_match('/<td bgcolor=\#A2BBB3 class=text12GBL colspan=3> (.*)<\/td>/Ui', $body, $results)) {
|
|
$tiVille=$results[1];
|
|
}
|
|
$tabTmp=explode('<a href="javascript:;" onClick="MM_openBrWindow(\'',$body);
|
|
$nb=count($tabTmp);
|
|
$etudeUrl=$etudeNom=$etudeVille=$site=$ench=$pais=$adresse=$cp=$ville=$tel=$fax=$mail=$txt='';
|
|
for ($i=1; isset($tabTmp[$i]);$i++) {
|
|
$etudeUrl=substr($tabTmp[$i],0,strpos($tabTmp[$i],"'"));
|
|
if(preg_match('/scrollbars=1\'\)">(.*)<\/a><\/td>/i', $tabTmp[$i], $results)) {
|
|
$etudeNom=$results[1];
|
|
}
|
|
if(preg_match('/<td bgcolor=\#E2F5F7 class=text12NN>(.*)<\/td>/i', $tabTmp[$i], $results)) {
|
|
$etudeVille=$results[1];
|
|
}
|
|
if(preg_match_all('/<td bgcolor=\#(?:E2F5F7|B9E7EB) class=text12NN align=center>(.*)<\/td>/i', $tabTmp[$i], $results)) {
|
|
if ($results[1][0]<>'') $site=preg_replace('/" target=(.*)/i','',preg_replace('/<a href="/i','',$results[1][0]));
|
|
if ($results[1][1]<>'') $ench='Ventes aux enchères';
|
|
if ($results[1][2]<>'') $pais='Paiement sécurisé';
|
|
}
|
|
|
|
$page=getUrl('http://www.huissier-justice.fr/annuaire/'.$etudeUrl, '', '', $url, false, 'www.huissier-justice.fr');
|
|
$body=$page['body'];
|
|
if (preg_match('/<span class=text12GB2>(.*)<\/span><br>/Ui', $body, $results)) {
|
|
$adresse=trim($results[1]);
|
|
}
|
|
if (preg_match('/<span class=text12GB>([\d]{4,5}) (.*)<\/span>/Ui', $body, $results)) {
|
|
$cp=$results[1];
|
|
$ville=trim($results[2]);
|
|
}
|
|
if (preg_match('/Tél : (.*)<br>/Ui', $body, $results)) {
|
|
$tel=$results[1];
|
|
}
|
|
if (preg_match('/Fax : (.*)<br>/Ui', $body, $results)) {
|
|
$fax=$results[1];
|
|
}
|
|
if (preg_match('/<a href="mailto:(.*)">/Ui', $body, $results)) {
|
|
$mail=$results[1];
|
|
}
|
|
$txt=trim(str_replace("\r\n",'|', strip_tags($body)));
|
|
|
|
echo $dep.$num.";$i/$nb;$tiVille;$etudeNom;$etudeVille;$cp;$ville;$tel;$fax;$mail;$site;$ench;$pais;$adresse;http://www.huissier-justice.fr/annuaire/$etudeUrl\n";//;$txt
|
|
randsleep(7,21);
|
|
}
|
|
} else break;
|
|
} // Fin boucle T.I.
|
|
} // Fin boucle départements
|
|
?>
|