diff options
author | John Kristensen <john@jerrykan.com> | 2013-04-02 16:33:42 +1100 |
---|---|---|
committer | John Kristensen <john@jerrykan.com> | 2013-04-02 16:33:42 +1100 |
commit | f26106507050067cacd738022e2faf1f16260c8f (patch) | |
tree | 43ffb1117e64b9e120e161f973f206a40ffe4a0a | |
parent | 104da1a02ccf1e1607979f19176afd27ea081ea0 (diff) |
Remove dependency on curl
The core ownCloud libraries provide a getUrlContent() util which will
attempt to retrieve the contents of a URL using curl with a fall-back to
get_file_contents(). By using getUrlContent() we can remove curl as a
dependency, which is useful for servers that don't have it installed.
-rw-r--r-- | utility/feedfetcher.php | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/utility/feedfetcher.php b/utility/feedfetcher.php index 2c37aa4d7..0fa805883 100644 --- a/utility/feedfetcher.php +++ b/utility/feedfetcher.php @@ -139,14 +139,9 @@ class FeedFetcher { //try to extract favicon from web page $absoluteUrl = \SimplePie_Misc::absolutize_url('/', $url); + $page = \OC_Util::getUrlContent($absoluteUrl); - $handle = curl_init ( ); - curl_setopt ( $handle, CURLOPT_URL, $absoluteUrl ); - curl_setopt ( $handle, CURLOPT_RETURNTRANSFER, 1 ); - curl_setopt ( $handle, CURLOPT_FOLLOWLOCATION, TRUE ); - curl_setopt ( $handle, CURLOPT_MAXREDIRS, 10 ); - - if ( FALSE!==($page=curl_exec($handle)) ) { + if ( FALSE !== $page ) { preg_match ( '/<[^>]*link[^>]*(rel=["\']icon["\']|rel=["\']shortcut icon["\']) .*href=["\']([^>]*)["\'].*>/iU', $page, $match ); if (1<sizeof($match)) { // the specified uri might be an url, an absolute or a relative path |