troublesome feed was a 307 redirect. We didn't recognise 307
This commit is contained in:
parent
341f853b04
commit
ecb300177c
2 changed files with 10 additions and 2 deletions
5
boot.php
5
boot.php
|
@ -682,7 +682,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
|
||||||
$s = substr($s,strlen($header)+4);
|
$s = substr($s,strlen($header)+4);
|
||||||
$header = substr($s,0,strpos($s,"\r\n\r\n"));
|
$header = substr($s,0,strpos($s,"\r\n\r\n"));
|
||||||
}
|
}
|
||||||
if($http_code == 301 || $http_code == 302 || $http_code == 303) {
|
if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
|
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
|
||||||
$url = trim(array_pop($matches));
|
$url = trim(array_pop($matches));
|
||||||
|
@ -2196,12 +2196,13 @@ function smilies($s) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
return str_replace(
|
return str_replace(
|
||||||
array( '<3', '</3', '<\\3', ':-)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O'),
|
array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O'),
|
||||||
array(
|
array(
|
||||||
'<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
|
'<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
|
||||||
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
|
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
|
||||||
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" />',
|
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" />',
|
||||||
'<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
|
'<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
|
||||||
|
'<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":)" />',
|
||||||
'<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
|
'<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
|
||||||
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
|
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
|
||||||
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":(" />',
|
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":(" />',
|
||||||
|
|
|
@ -446,9 +446,16 @@ function probe_url($url) {
|
||||||
$feed = new SimplePie();
|
$feed = new SimplePie();
|
||||||
$xml = fetch_url($poll);
|
$xml = fetch_url($poll);
|
||||||
|
|
||||||
|
logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA);
|
||||||
|
$a = get_app();
|
||||||
|
|
||||||
|
logger('probe_url: scrape_feed: headers: ' . $a->get_curl_headers(), $LOGGER_DATA);
|
||||||
|
|
||||||
$feed->set_raw_data($xml);
|
$feed->set_raw_data($xml);
|
||||||
|
|
||||||
$feed->init();
|
$feed->init();
|
||||||
|
if($feed->error())
|
||||||
|
logger('probe_url: scrape_feed: Error parsing XML: ' . $feed->error());
|
||||||
|
|
||||||
if(! x($vcard,'photo'))
|
if(! x($vcard,'photo'))
|
||||||
$vcard['photo'] = $feed->get_image_url();
|
$vcard['photo'] = $feed->get_image_url();
|
||||||
|
|
Loading…
Reference in a new issue