From: Nicolas LÅ“uillet Date: Tue, 7 Jan 2014 12:15:43 +0000 (+0100) Subject: [add] user_agent in file_get_contents X-Git-Tag: 1.3.1^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=e1cf0fda27df031e478e55d6df08823d42fe2220;p=github%2Fwallabag%2Fwallabag.git [add] user_agent in file_get_contents --- diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index e9ff7b46..76a73be2 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'];