Merge branch 'hotfix-bodaccpdf' into develop

Conflicts:
	.gitignore
This commit is contained in:
Michael RICOIS 2016-04-20 17:30:20 +02:00
commit 4425400587
2 changed files with 18 additions and 13 deletions

7
.gitignore vendored
View File

@ -1,4 +1,11 @@
<<<<<<< HEAD
/.settings/
/.buildpath
/.project
/vendor/
=======
/vendor/
/.buildpath
/.project
/.settings/
>>>>>>> refs/heads/hotfix-bodaccpdf

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']);