news / sources / news-constants.php /
9d6143f 7 years ago
1 contributor
42 lines | 1.215kb
<?php
define('NEWS_RSS_LEMONDE', 'http://www.lemonde.fr/rss/une.xml');
define('NEWS_RSS_LIBERATION', 'http://rss.liberation.fr/rss/latest/');
define('NEWS_RSS_SLATEFR', 'https://www.slate.fr/rss.xml');
define('NEWS_RSS_VICEFR', 'https://www.vice.com/fr/rss');
define('NEWS_RSS_LESINROCKS', 'http://www.lesinrocks.com/feeds/feed-a-la-une/');
define('NEWS_RSS_NUMERAMA', 'http://www.numerama.com/rss/news.rss');
$NEWS_RSS_MAX_ITEMS = 10;

function DOMinnerHTML(DOMNode $element) 
{ 
    $innerHTML = ""; 
    $children  = $element->childNodes;

    foreach ($children as $child) 
    { 
        $innerHTML .= $element->ownerDocument->saveHTML($child);
    }

    return $innerHTML; 
}

function http_get_contents($url, $opts = [])
{
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  curl_setopt($ch, CURLOPT_USERAGENT, "Wget 1");
  curl_setopt($ch, CURLOPT_URL, $url);
  if(is_array($opts) && $opts) {
    foreach($opts as $key => $val) {
      curl_setopt($ch, $key, $val);
    }
  }
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  if(FALSE === ($retval = curl_exec($ch))) {
    error_log(curl_error($ch));
  } else {
    return $retval;
  }
}
?>