CopieDoubleBridge.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. class CopieDoubleBridge extends BridgeAbstract{
  3. public function loadMetadatas() {
  4. $this->maintainer = "superbaillot.net";
  5. $this->name = "CopieDouble";
  6. $this->uri = "http://www.copie-double.com/";
  7. $this->description = "CopieDouble";
  8. }
  9. public function collectData(array $param){
  10. $html = $this->getSimpleHTMLDOM('http://www.copie-double.com/') or $this->returnServerError('Could not request CopieDouble.');
  11. $table = $html->find('table table', 2);
  12. foreach($table->find('tr') as $element)
  13. {
  14. $td = $element->find('td', 0);
  15. $cpt++;
  16. if($td->class == "couleur_1")
  17. {
  18. $item = array();
  19. $title = $td->innertext;
  20. $pos = strpos($title, "<a");
  21. $title = substr($title, 0, $pos);
  22. $item['title'] = $title;
  23. }
  24. elseif(strpos($element->innertext, "/images/suivant.gif") === false)
  25. {
  26. $a=$element->find("a", 0);
  27. $item['uri'] = "http://www.copie-double.com" . $a->href;
  28. $content = str_replace('src="/', 'src="http://www.copie-double.com/',$element->find("td", 0)->innertext);
  29. $content = str_replace('href="/', 'href="http://www.copie-double.com/',$content);
  30. $item['content'] = $content;
  31. $this->items[] = $item;
  32. }
  33. }
  34. }
  35. public function getCacheDuration(){
  36. return 14400; // 4 hours
  37. }
  38. }