title)){ $sql = "UPDATE lalina_feeds SET name = '".addslashes($rss->title)."' WHERE id = '".addslashes($feed['id'])."'"; runSQL($sql); } foreach($rss->items as $item){ $sql = "INSERT IGNORE INTO lalina_items SET feed_id = '".$feed['id']."', url = '".addslashes($item['link'])."', title = '".addslashes($item['title'])."', body = '".addslashes($item['body'])."', dt = FROM_UNIXTIME(".addslashes($item['datetime']).")"; runSQL($sql); print "."; flush(); } } function getFeed($feed,&$enc){ $http = new DokuHTTPClient(); $http->timeout = 45; // prepare conditional request if($feed['lastmod']){ $http->headers['If-Modified-Since'] = $feed['lastmod']; } if($feed['etag']){ $http->headers['If-None-Match'] = $feed['etag']; } print "sending request\n"; // send request $http->sendRequest($feed['url']); print "sending request done\n"; if($http->error){ print "ERROR ".$http->error."\n"; } // check status if($http->status != 200){ return ''; } // save headers if($http->resp_headers['last-modified']){ $sql = "UPDATE lalina_feeds SET lastmod = '". addslashes($http->resp_headers['last-modified']). "' WHERE id = ".$feed['id']; runSQL($sql); } if($http->resp_headers['etag']){ $sql = "UPDATE lalina_feeds SET etag = '". addslashes($http->resp_headers['etag']). "' WHERE id = ".$feed['id']; runSQL($sql); } $ctype = $http->resp_headers['content-type']; if(preg_match('/charset=([\w\-]+)/i',$ctype,$match)){ $enc = $match[1]; } // return data return $http->resp_body; } //Setup VIM: ex: et ts=4 enc=utf-8 : ?>