mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-12-18 00:43:19 +03:00
c9b0cd1315
This seems like a weird bug somewhere. Either the HTML parser should return the valid page, or the CMS should not convert the URL first, or the URL validation regex is buggy.
22 lines
684 B
PHP
22 lines
684 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')
|
|
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 . implode('/', array_map('urlencode', explode('/', $element->href)));
|
|
|
|
$this->items[] = $item;
|
|
}
|
|
}
|
|
}
|