custom user-agent also for simplexml_load_file-method of reading news-feed

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-12-06 10:31:22 +01:00
parent ce1608ab2c
commit b762cce94d

View File

@@ -31,9 +31,10 @@ if ($action == "newsfeed") {
die(); die();
} }
// get version
require './tables.inc.php';
if (function_exists('curl_version')) { if (function_exists('curl_version')) {
// get version
require './tables.inc.php';
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $feed); curl_setopt($ch, CURLOPT_URL, $feed);
curl_setopt($ch, CURLOPT_USERAGENT, 'Froxlor/'.$version); curl_setopt($ch, CURLOPT_USERAGENT, 'Froxlor/'.$version);
@@ -43,6 +44,7 @@ if ($action == "newsfeed") {
$news = simplexml_load_string(trim($output)); $news = simplexml_load_string(trim($output));
} else { } else {
if (ini_get('allow_url_fopen')) { if (ini_get('allow_url_fopen')) {
ini_set('user_agent', 'Froxlor/'.$version);
$news = simplexml_load_file($feed, null, LIBXML_NOCDATA); $news = simplexml_load_file($feed, null, LIBXML_NOCDATA);
} else { } else {
$news = false; $news = false;