blob: 680eaf6cf6f0c237eb9c576cf66b3da1124612c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
namespace Providers;
require_once('Rss.php');
class Tumblr extends \Providers\Rss {
private $_encoding;
protected function __getUserAgent() {
return 'Wget';
}
protected function _getFeedUrl($feed) {
return sprintf('https://%s.tumblr.com/rss', $feed);
}
protected function _getCachePath() {
return '../cache/tumblr.%s';
}
private function __getHttpContent($feedUrl) {
$ch = curl_init($feedUrl);
curl_setopt($ch, CURLOPT_USERAGENT, $this->__getUserAgent());
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$page = curl_exec($ch);
curl_close ($ch);
return $page;
}
protected function _fetchItems() {
$page = $this->__getHttpContent($this->_feedUrl);
$this->_feedXml = new \SimpleXMLElement($page);
return $this->_parseFeedContent($this->_feedXml);
}
}
?>
|