From e1cf0fda27df031e478e55d6df08823d42fe2220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 7 Jan 2014 13:15:43 +0100 Subject: [PATCH] [add] user_agent in file_get_contents --- inc/poche/Poche.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index e9ff7b46c..76a73be2b 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -333,7 +333,9 @@ class Poche switch ($action) { case 'add': - $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed'); + $options = array('http' => array('user_agent' => 'poche')); + $context = stream_context_create($options); + $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed', false, $context); $content = json_decode($json, true); $title = $content['rss']['channel']['item']['title']; $body = $content['rss']['channel']['item']['description'];