Bodacc Pdf : Changement de l'url de détail de l'annonce

This commit is contained in:
Michael RICOIS 2016-04-20 17:28:14 +02:00
parent 91cc5d9dc2
commit b8a7edc0c2

View File

@ -90,8 +90,8 @@ echo "\n";
$result = getPage($url, $data);
if ($debug) file_put_contents('bodacc1.html', $result['content']);
echo $url = $site."/annonce/liste";
echo "\n";
$url = $site."/annonce/liste";
echo $url."\n";
$data = array(
'categorieannonce' => 'tout',
'commercant' => '',
@ -107,13 +107,14 @@ $data = array(
);
$result = getPage($url, $data);
if ($debug) file_put_contents('bodacc2.html', $result['content']);
preg_match('/\<a href="\/annonce\/detail\/(.*)"\>/', $result['content'], $matches);
echo $url = $site.'/annonce/detail/'.$matches[1];
echo "\n";
preg_match('/\<a href="\/annonce\/detail-annonce\/(.*)"\>/', $result['content'], $matches);
$url = null;
if (count($matches) > 0) {
$url = $site.'/annonce/detail-annonce/'.$matches[1];
echo $url."\n";
}
if (empty($url)) {
echo "Erreur téléchargement du PDF.";
echo "\n";
echo "Erreur Detail de l'annonce.\n";
exit;
}
@ -129,12 +130,10 @@ Téléchargez le témoin de publication
</p>
*/
preg_match('/\<a href="\/annonce\/telecharger\/(.*)"/', $result['content'], $matches);
echo $url = $site.'/annonce/telecharger/'.$matches[1];
echo "\n";
if (empty($url)) {
echo "Erreur téléchargement du PDF.";
echo "\n";
echo "Erreur téléchargement du PDF.\n";
exit;
}
@ -142,8 +141,7 @@ if (empty($url)) {
$result = getPage($url);
if (substr($result['content'],0,4)!='%PDF'){
if ($debug) file_put_contents('bodacc4.html', $result['content']);
echo "Erreur téléchargement du PDF.";
echo "\n";
echo "Erreur téléchargement du PDF.\n";
exit;
}
file_put_contents($directory."/BODACC_".$type."_".$annee."_".$num.".pdf", $result['content']);