FierPandaBridge.php 798 B

123456789101112131415161718192021222324
  1. <?php
  2. class FierPandaBridge extends BridgeAbstract {
  3. const MAINTAINER = 'snroki';
  4. const NAME = 'Fier Panda Bridge';
  5. const URI = 'http://www.fier-panda.fr/';
  6. const CACHE_TIMEOUT = 21600; // 6h
  7. const DESCRIPTION = 'Returns latest articles from Fier Panda.';
  8. public function collectData(){
  9. $html = getSimpleHTMLDOM(self::URI)
  10. or returnServerError('Could not request Fier Panda.');
  11. foreach($html->find('div.container-content article') as $element) {
  12. $item = array();
  13. $item['uri'] = $this->getURI() . $element->find('a', 0)->href;
  14. $item['title'] = trim($element->find('h1 a', 0)->innertext);
  15. // Remove the link at the end of the article
  16. $element->find('p a', 0)->outertext = '';
  17. $item['content'] = $element->find('p', 0)->innertext;
  18. $this->items[] = $item;
  19. }
  20. }
  21. }