require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
-define ( 'FRIENDICA_VERSION', '2.3.1263' );
+define ( 'FRIENDICA_VERSION', '2.3.1264' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1126 );
$ret = array();
$s = fetch_url($url);
- if(! $s)
+ $headers = $a->get_curl_headers();
+ $code = $a->get_curl_code();
+
+ logger('scrape_feed: returns: ' . $code . ' headers=' . $headers, LOGGER_DEBUG);
+
+ if(! $s) {
+ logger('scrape_feed: no data returned for ' . $url);
return $ret;
+ }
- $headers = $a->get_curl_headers();
- logger('scrape_feed: headers=' . $headers, LOGGER_DEBUG);
$lines = explode("\n",$headers);
if(count($lines)) {
logger('scrape_feed: parse error: ' . $e);
}
- if(! $dom)
+ if(! $dom) {
+ logger('scrape_feed: failed to parse.');
return $ret;
+ }
$head = $dom->getElementsByTagName('base');
if($check_feed) {
$feedret = scrape_feed(($poll) ? $poll : $url);
- logger('probe_url: scrape_feed returns: ' . print_r($feedret,true), LOGGER_DATA);
+ logger('probe_url: scrape_feed ' . (($poll)? $poll : $url) . ' returns: ' . print_r($feedret,true), LOGGER_DATA);
if(count($feedret) && ($feedret['feed_atom'] || $feedret['feed_rss'])) {
$poll = ((x($feedret,'feed_atom')) ? unamp($feedret['feed_atom']) : unamp($feedret['feed_rss']));
if(! x($vcard))
if (!is_null($accept_content)){
curl_setopt($ch,CURLOPT_HTTPHEADER, array (
- "Accept: "+$accept_content
+ "Accept: " . $accept_content
));
}
$curl_info = @curl_getinfo($ch);
$http_code = $curl_info['http_code'];
+// logger('fetch_url:' . $http_code . ' data: ' . $s);
$header = '';
// Pull out multiple headers, e.g. proxy and continuation headers
if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
$matches = array();
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
- $url = trim(array_pop($matches));
- $url_parsed = @parse_url($url);
+ $newurl = trim(array_pop($matches));
+ if(strpos($newurl,'/') === 0)
+ $newurl = $url . $newurl;
+ $url_parsed = @parse_url($newurl);
if (isset($url_parsed)) {
$redirects++;
- return fetch_url($url,$binary,$redirects,$timeout);
+ return fetch_url($newurl,$binary,$redirects,$timeout);
}
}
if($http_code == 301 || $http_code == 302 || $http_code == 303) {
$matches = array();
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
- $url = trim(array_pop($matches));
- $url_parsed = @parse_url($url);
+ $newurl = trim(array_pop($matches));
+ if(strpos($newurl,'/') === 0)
+ $newurl = $url . $newurl;
+ $url_parsed = @parse_url($newurl);
if (isset($url_parsed)) {
$redirects++;
- return post_url($url,$params,$headers,$redirects,$timeout);
+ return fetch_url($newurl,$binary,$redirects,$timeout);
}
}
$a->set_curl_code($http_code);