You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
887 B

  1. <?php
  2. namespace App\Parser;
  3. use App\ParsedHome;
  4. use App\Parser;
  5. class SeLoger extends Parser
  6. {
  7. protected $params = [
  8. 'idtt' => 1,
  9. 'idtypebien' => '1,2',
  10. 'getDtCreationMax' => 1,
  11. ];
  12. /**
  13. * @inheritDoc
  14. */
  15. public function parse(): ParsedHome
  16. {
  17. $idAnnonce = $this->getIdAnnonceFromUrl($this->url);
  18. var_dump($idAnnonce);
  19. $payload = $this->params + ['noAudiotel' => 1, 'idAnnonce' => $idAnnonce];
  20. $request = $this->client->request('GET', "http://ws.seloger.com/annonceDetail_4.0.xml", $payload);
  21. var_dump($request);
  22. exit;
  23. }
  24. private function getIdAnnonceFromUrl($url)
  25. {
  26. // ex : https://www.seloger.com/annonces/achat/maison/franconville-95/vieux-marche-mare-des-noues/159100953.htm
  27. return collect(explode('.', collect(explode('/', $url))->last()))->first();
  28. }
  29. }