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