aboutsummaryrefslogtreecommitdiffstats
path: root/include/Scrape.php
diff options
context:
space:
mode:
authorTobias Hößl <tobias@hoessl.eu>2012-02-28 21:19:02 +0000
committerTobias Hößl <tobias@hoessl.eu>2012-02-28 21:19:02 +0000
commit3d249f0eddb058f74b33d8205202b17ab7555aa6 (patch)
tree112e38aa464e5830832ff92a93e10f2566cbe27e /include/Scrape.php
parent36a1a43f06dc2a0d55463c83154cce55fa3948ad (diff)
parent733f830be4b554c83361e877a5f1108767a815fc (diff)
downloadvolse-hubzilla-3d249f0eddb058f74b33d8205202b17ab7555aa6.tar.gz
volse-hubzilla-3d249f0eddb058f74b33d8205202b17ab7555aa6.tar.bz2
volse-hubzilla-3d249f0eddb058f74b33d8205202b17ab7555aa6.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'include/Scrape.php')
-rwxr-xr-xinclude/Scrape.php32
1 files changed, 24 insertions, 8 deletions
diff --git a/include/Scrape.php b/include/Scrape.php
index 52405ae2d..4c4ad3cdb 100755
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -230,11 +230,16 @@ function scrape_feed($url) {
$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)) {
@@ -258,8 +263,10 @@ function scrape_feed($url) {
logger('scrape_feed: parse error: ' . $e);
}
- if(! $dom)
+ if(! $dom) {
+ logger('scrape_feed: failed to parse.');
return $ret;
+ }
$head = $dom->getElementsByTagName('base');
@@ -445,10 +452,19 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$adr = imap_rfc822_parse_adrlist($x->to,'');
if(isset($adr)) {
foreach($adr as $feadr) {
- if((strcasecmp($feadr->mailbox,$name) == 0)
- &&(strcasecmp($feadr->host,$phost) == 0)
+ if((strcasecmp($feadr->mailbox,$name) == 0)
+ &&(strcasecmp($feadr->host,$phost) == 0)
&& (strlen($feadr->personal))) {
- $vcard['fn'] = notags($feadr->personal);
+
+ $personal = imap_mime_header_decode($feadr->personal);
+ $vcard['fn'] = "";
+ foreach($personal as $perspart)
+ if ($perspart->charset != "default")
+ $vcard['fn'] .= iconv($perspart->charset, 'UTF-8//IGNORE', $perspart->text);
+ else
+ $vcard['fn'] .= $perspart->text;
+
+ $vcard['fn'] = notags($vcard['fn']);
}
}
}
@@ -556,7 +572,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
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))