From: Florian Pritz Date: Fri, 23 Sep 2011 10:49:14 +0000 (+0200) Subject: apps/bookmarks: use curl instead of file_get_contents X-Git-Tag: v3.0~161^2~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d7c165eb358411135647c93a47e3496477d1b4e5;p=nextcloud-server.git apps/bookmarks: use curl instead of file_get_contents Don't depend on allow_url_fopen being enabled when we already use curl elsewhere in the code. Signed-off-by: Florian Pritz --- diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php index aee941a27b9..d674e595a80 100644 --- a/apps/bookmarks/bookmarksHelper.php +++ b/apps/bookmarks/bookmarksHelper.php @@ -9,7 +9,12 @@ function getURLMetadata($url) { } $metadata['url'] = $url; - $page = file_get_contents($url); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $page = curl_exec($ch); + curl_close($ch); + @preg_match( "/(.*)<\/title>/si", $page, $match ); $metadata['title'] = htmlspecialchars_decode(@$match[1]);