note 82255 added to function.file-get-contents

From: Date: Wed, 02 Apr 2008 21:12:36 +0000
Subject: note 82255 added to function.file-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-137870@lists.php.net to get a copy of this message
This is a nice and simple substitute to get_file_contents() using curl, it returns FALSE if $contents is empty. <?php function curl_get_file_contents($URL) { $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, $URL); $contents = curl_exec($c); curl_close($c); if ($contents) return $contents; else return FALSE; } ?> Hope this help, if there is something wrong or something you don't understand let me know :) ---- Server IP: 80.241.173.254 Probable Submitter: 82.107.15.112 ---- Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php Edit -- https://master.php.net/note/edit/82255 Del: integrated -- https://master.php.net/note/delete/82255/integrated Del: useless -- https://master.php.net/note/delete/82255/useless Del: bad code -- https://master.php.net/note/delete/82255/bad+code Del: spam -- https://master.php.net/note/delete/82255/spam Del: non-english -- https://master.php.net/note/delete/82255/non-english Del: in docs -- https://master.php.net/note/delete/82255/in+docs Del: other reasons-- https://master.php.net/note/delete/82255 Reject -- https://master.php.net/note/reject/82255 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137870) next »