aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Poche.class.php')
-rw-r--r--inc/poche/Poche.class.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index d4733218..0be1668d 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -326,6 +326,22 @@ class Poche
326 ); 326 );
327 } 327 }
328 328
329 protected function getPageContent(Url $url)
330 {
331 $options = array('http' => array('user_agent' => 'poche'));
332 if (isset($_SERVER['AUTH_TYPE']) && "basic" === strtolower($_SERVER['AUTH_TYPE'])) {
333 $options['http']['header'] = sprintf(
334 "Authorization: Basic %s",
335 base64_encode(
336 sprintf('%s:%s', $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])
337 )
338 );
339 }
340 $context = stream_context_create($options);
341 $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);
342 return json_decode($json, true);
343 }
344
329 /** 345 /**
330 * Call action (mark as fav, archive, delete, etc.) 346 * Call action (mark as fav, archive, delete, etc.)
331 */ 347 */
@@ -334,10 +350,7 @@ class Poche
334 switch ($action) 350 switch ($action)
335 { 351 {
336 case 'add': 352 case 'add':
337 $options = array('http' => array('user_agent' => 'poche')); 353 $content = $this->getPageContent($url);
338 $context = stream_context_create($options);
339 $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);
340 $content = json_decode($json, true);
341 $title = $content['rss']['channel']['item']['title']; 354 $title = $content['rss']['channel']['item']['title'];
342 $body = $content['rss']['channel']['item']['description']; 355 $body = $content['rss']['channel']['item']['description'];
343 356