diff --git a/bridges/LeBonCoinBridge.php b/bridges/LeBonCoinBridge.php
index 57c58c61..295a188c 100644
--- a/bridges/LeBonCoinBridge.php
+++ b/bridges/LeBonCoinBridge.php
@@ -150,43 +150,35 @@ class LeBonCoinBridge extends BridgeAbstract {
)
);
+ public static $LBC_API_KEY = 'ba0c2dad52b3ec';
+
public function collectData(){
- $params = array(
- 'text' => $this->getInput('k'),
- 'region' => $this->getInput('r'),
- 'cities' => $this->getInput('cities'),
- 'category' => $this->getInput('c'),
- 'owner_type' => $this->getInput('o'),
- );
-
- $url = self::URI . 'recherche/?' . http_build_query($params);
+ $url = 'https://api.leboncoin.fr/finder/search/';
+ $data = $this->buildRequestJson();
$header = array(
- 'Accept: text/html',
- 'Accept-Language: ' . getEnv('HTTP_ACCEPT_LANGUAGE'),
- 'Accept-Encoding: identity'
+ 'Content-Type: application/json',
+ 'Content-Length: ' . strlen($data),
+ 'api_key: ' . self::$LBC_API_KEY
);
- $html = getContents($url, $header)
+ $opts = array(
+ CURL_CUSTOMREQUEST => 'POST',
+ CURLOPT_POSTFIELDS => $data
+
+ );
+
+ $content = getContents($url, $header, $opts)
or returnServerError('Could not request LeBonCoin. Tried: ' . $url);
- if(!preg_match('/^', '