note 103977 added to function.fopen

From: Date: Sun, 15 May 2011 15:00:49 +0000
Subject: note 103977 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-179733@lists.php.net to get a copy of this message
Use CURL to access files outside of your server (if you get Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration): Instead of using: $file = "http://www.website.com/file.txt"; Use: $file = "http://www.website.com/file.txt"; $ch = curl_init($file); $fp = @fopen("temp.xml", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); $file = "temp.xml"; //IMPORTANT: add an empty temp.xml file to your server and chmod to 666 so it can be written to. If you don't know if you have CURL on your version of PHP, add: <?php phpinfo(); ?> to a PHP web page and look for the CURL section. Or, you could simply try the code above and see if it works. ---- Server IP: 69.147.83.197 Probable Submitter: 24.131.51.18 ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- https://master.php.net/note/edit/103977 Del: integrated -- https://master.php.net/note/delete/103977/integrated Del: useless -- https://master.php.net/note/delete/103977/useless Del: bad code -- https://master.php.net/note/delete/103977/bad+code Del: spam -- https://master.php.net/note/delete/103977/spam Del: non-english -- https://master.php.net/note/delete/103977/non-english Del: in docs -- https://master.php.net/note/delete/103977/in+docs Del: other reasons-- https://master.php.net/note/delete/103977 Reject -- https://master.php.net/note/reject/103977 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#179733) next »