note 55922 deleted from function.fopen by cmb

From: Date: Sun, 09 Feb 2020 08:17:22 +0000
Subject: note 55922 deleted from function.fopen by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-214050@lists.php.net to get a copy of this message
Note Submitter: Luiz Miguel Axcar (lmaxcar at yahoo dot com dot br) ---- 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); ?>

« previous php.notes (#214050) next »