MyHomeCollection/app/Parser/SeLoger.php

35 lines
887 B
PHP
Raw Normal View History

2020-07-23 12:26:10 +02:00
<?php
namespace App\Parser;
use App\ParsedHome;
use App\Parser;
class SeLoger extends Parser
{
protected $params = [
'idtt' => 1,
'idtypebien' => '1,2',
'getDtCreationMax' => 1,
];
/**
* @inheritDoc
*/
public function parse(): ParsedHome
{
$idAnnonce = $this->getIdAnnonceFromUrl($this->url);
var_dump($idAnnonce);
$payload = $this->params + ['noAudiotel' => 1, 'idAnnonce' => $idAnnonce];
$request = $this->client->request('GET', "http://ws.seloger.com/annonceDetail_4.0.xml", $payload);
var_dump($request);
exit;
}
private function getIdAnnonceFromUrl($url)
{
// ex : https://www.seloger.com/annonces/achat/maison/franconville-95/vieux-marche-mare-des-noues/159100953.htm
return collect(explode('.', collect(explode('/', $url))->last()))->first();
}
}