mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-23 10:05:32 +03:00
37cb4091d4
When fetching website contents, exceptions already raise on fetching error
21 lines
634 B
PHP
21 lines
634 B
PHP
<?php
|
|
class ComboiosDePortugalBridge extends BridgeAbstract {
|
|
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';
|
|
|
|
public function collectData() {
|
|
$html = getSimpleHTMLDOM($this->getURI() . '/consultar-horarios/avisos');
|
|
|
|
foreach($html->find('.warnings-table a') as $element) {
|
|
$item = array();
|
|
|
|
$item['title'] = $element->innertext;
|
|
$item['uri'] = self::BASE_URI . implode('/', array_map('urlencode', explode('/', $element->href)));
|
|
|
|
$this->items[] = $item;
|
|
}
|
|
}
|
|
}
|