LinkedInCompanyBridge.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. class LinkedInCompanyBridge extends BridgeAbstract {
  3. const MAINTAINER = 'regisenguehard';
  4. const NAME = 'LinkedIn Company';
  5. const URI = 'https://www.linkedin.com/';
  6. const CACHE_TIMEOUT = 21600; //6
  7. const DESCRIPTION = 'Returns most recent actus from Company on LinkedIn.
  8. (https://www.linkedin.com/company/<strong style=\"font-weight:bold;\">apple</strong>)';
  9. const PARAMETERS = array( array(
  10. 'c' => array(
  11. 'name' => 'Company name',
  12. 'required' => true
  13. )
  14. ));
  15. public function collectData(){
  16. $html = '';
  17. $link = self::URI . 'company/' . $this->getInput('c');
  18. $html = getSimpleHTMLDOM($link)
  19. or returnServerError('Could not request LinkedIn.');
  20. foreach($html->find('//*[@id="my-feed-post"]/li') as $element) {
  21. $title = $element->find('span.share-body', 0)->innertext;
  22. if($title) {
  23. $item = array();
  24. $item['uri'] = $link;
  25. $item['title'] = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0, 100);
  26. $item['content'] = strip_tags($element->find('span.share-body', 0)->innertext);
  27. $this->items[] = $item;
  28. $i++;
  29. }
  30. }
  31. }
  32. }