Avoid bot exclusion.

This commit is contained in:
Quentin Delmas 2018-08-22 16:21:39 +01:00
parent be3620acb7
commit 9fc1e97efe

View file

@ -161,7 +161,14 @@ class LeBonCoinBridge extends BridgeAbstract {
); );
$url = self::URI . 'recherche/?' . http_build_query($params); $url = self::URI . 'recherche/?' . http_build_query($params);
$html = getContents($url)
$header = array(
'Accept: text/html',
'Accept-Language: ' . getEnv('HTTP_ACCEPT_LANGUAGE'),
'Accept-Encoding: identity'
);
$html = getContents($url, $header)
or returnServerError('Could not request LeBonCoin. Tried: ' . $url); or returnServerError('Could not request LeBonCoin. Tried: ' . $url);
if(!preg_match('/^<script>window.FLUX_STATE[^\r\n]*/m', $html, $matches)) { if(!preg_match('/^<script>window.FLUX_STATE[^\r\n]*/m', $html, $matches)) {