From 4007876b847e711d25f08b6e6e8cc624ee21c794 Mon Sep 17 00:00:00 2001 From: Matthew Exon Date: Mon, 25 Jan 2016 03:34:53 +0100 Subject: [PATCH] Use more cookies to allow processing of the NYT feed Conflicts: include/Scrape.php --- include/Scrape.php | 8 ++++++-- include/onepoll.php | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/Scrape.php b/include/Scrape.php index 9cc7086157..7329489817 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -235,7 +235,9 @@ function scrape_feed($url) { $a = get_app(); $ret = array(); - $s = fetch_url($url); + $cookiejar = tempnam('/tmp', 'cookiejar-scrape-feed-'); + $s = fetch_url($url, false, $redirects, 0, Null, $cookiejar); + unlink($cookiejar); $headers = $a->get_curl_headers(); $code = $a->get_curl_code(); @@ -662,7 +664,9 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) { $vcard['photo'] = $feedret['photo']; require_once('library/simplepie/simplepie.inc'); $feed = new SimplePie(); - $xml = fetch_url($poll); + $cookiejar = tempnam('/tmp', 'cookiejar-scrape-feed-'); + $xml = fetch_url($poll, false, $redirects, 0, Null, $cookiejar); + unlink($cookiejar); logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA); $a = get_app(); diff --git a/include/onepoll.php b/include/onepoll.php index 516f1dfd4d..5ebafb353e 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -335,7 +335,9 @@ function onepoll_run(&$argv, &$argc){ if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) return; - $xml = fetch_url($contact['poll']); + $cookiejar = tempnam('/tmp', 'cookiejar-onepoll-'); + $xml = fetch_url($contact['poll'], false, $redirects, 0, Null, $cookiejar); + unlink($cookiejar); } elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) { -- 2.39.5