mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-27 11:22:17 -05:00
Merge branch 'extraction-with-basic-auth' of git://github.com/aaa2000/poche into aaa2000-extraction-with-basic-auth
This commit is contained in:
commit
1b539ba1ec
@ -326,6 +326,22 @@ class Poche
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getPageContent(Url $url)
|
||||||
|
{
|
||||||
|
$options = array('http' => array('user_agent' => 'poche'));
|
||||||
|
if (isset($_SERVER['AUTH_TYPE']) && "basic" === strtolower($_SERVER['AUTH_TYPE'])) {
|
||||||
|
$options['http']['header'] = sprintf(
|
||||||
|
"Authorization: Basic %s",
|
||||||
|
base64_encode(
|
||||||
|
sprintf('%s:%s', $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$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);
|
||||||
|
return json_decode($json, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call action (mark as fav, archive, delete, etc.)
|
* Call action (mark as fav, archive, delete, etc.)
|
||||||
*/
|
*/
|
||||||
@ -334,10 +350,7 @@ class Poche
|
|||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
case 'add':
|
case 'add':
|
||||||
$options = array('http' => array('user_agent' => 'poche'));
|
$content = $this->getPageContent($url);
|
||||||
$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'];
|
$title = $content['rss']['channel']['item']['title'];
|
||||||
$body = $content['rss']['channel']['item']['description'];
|
$body = $content['rss']['channel']['item']['description'];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user