note 55922 added to function.fopen

From: Date: Wed, 17 Aug 2005 20:11:12 +0000
Subject: note 55922 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-93807@lists.php.net to get a copy of this message
If you are getting message "Warning: fopen(): URL file-access is disabled in the server configuration", you can use function below to get the content from a local or remote file. Function uses CURL lib, follow the link to get help: http://www.php.net/curl <?php /* * @return string * @param string $url * @desc Return string content from a remote file * @author Luiz Miguel Axcar (lmaxcar@yahoo.com.br) */ function get_content($url) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 0); ob_start(); curl_exec ($ch); curl_close ($ch); $string = ob_get_contents(); ob_end_clean(); return $string; } #usage: $content = get_content ("http://www.php.net"); var_dump ($content); ?> ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55922 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55922&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55922&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55922&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55922&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55922&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55922&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55922&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93807) next »