[ComboiosDePortugalBridge] Add new bridge (#1049)
This commit is contained in:
parent
d37f0c14a0
commit
dac685b887
1 changed files with 22 additions and 0 deletions
22
bridges/ComboiosDePortugalBridge.php
Normal file
22
bridges/ComboiosDePortugalBridge.php
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<?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')
|
||||||
|
or returnServerError('Could not load content');
|
||||||
|
|
||||||
|
foreach($html->find('.warnings-table a') as $element) {
|
||||||
|
$item = array();
|
||||||
|
|
||||||
|
$item['title'] = $element->innertext;
|
||||||
|
$item['uri'] = self::BASE_URI . $element->href;
|
||||||
|
|
||||||
|
$this->items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue