2019-03-02 21:05:23 +03:00
|
|
|
<?php
|
|
|
|
|
2022-01-05 02:44:59 +03:00
|
|
|
class ComboiosDePortugalBridge extends BridgeAbstract
|
2022-07-01 16:10:30 +03:00
|
|
|
{
|
2022-01-05 02:44:59 +03:00
|
|
|
const NAME = 'CP | Avisos';
|
|
|
|
const BASE_URI = 'https://www.cp.pt';
|
|
|
|
const URI = self::BASE_URI . '/passageiros/pt';
|
|
|
|
const DESCRIPTION = 'Comboios de Portugal | Avisos';
|
|
|
|
const MAINTAINER = 'somini';
|
2019-03-02 21:05:23 +03:00
|
|
|
|
|
|
|
public function collectData()
|
|
|
|
{
|
|
|
|
# Do not verify SSL certificate (the server doesn't send the intermediate)
|
2022-01-05 02:44:59 +03:00
|
|
|
# https://github.com/RSS-Bridge/rss-bridge/issues/2397
|
2019-03-02 21:05:23 +03:00
|
|
|
$html = getSimpleHTMLDOM($this->getURI() . '/consultar-horarios/avisos', [], [
|
|
|
|
CURLOPT_SSL_VERIFYPEER => 0,
|
|
|
|
]);
|
|
|
|
|
2019-04-04 23:48:25 +03:00
|
|
|
foreach ($html->find('.warnings-table a') as $element) {
|
|
|
|
$item = [];
|
2019-03-02 21:05:23 +03:00
|
|
|
|
|
|
|
$item['title'] = $element->innertext;
|
2019-04-04 23:48:25 +03:00
|
|
|
$item['uri'] = self::BASE_URI . implode('/', array_map('urlencode', explode('/', $element->href)));
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-03-02 21:05:23 +03:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
2022-07-01 16:10:30 +03:00
|
|
|
}
|
2019-03-02 21:05:23 +03:00
|
|
|
}
|