note 96217 added to function.file-put-contents

From: Date: Mon, 15 Feb 2010 20:14:42 +0000
Subject: note 96217 added to function.file-put-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-165983@lists.php.net to get a copy of this message
Please note that when saving using an FTP host, an additional stream context must be passed through telling PHP to overwrite the file. <?php /* set the FTP hostname */ $user = "test"; $pass = "myFTP"; $host = "host.com"; $file = "test.txt"; $hostname = $user . ":" . $pass . "@" . $host . "/" . $file; /* the file content */ $content = "this is just a test."; /* create a stream context telling PHP to overwrite the file */ $options = array('ftp' => array('overwrite' => true)); $stream = stream_context_create($options); /* and finally, put the contents */ file_put_contents($hostname, $content, 0, $stream); ?> ---- Server IP: 83.137.20.135 Probable Submitter: 84.28.177.180 ---- Manual Page -- http://www.php.net/manual/en/function.file-put-contents.php Edit -- https://master.php.net/note/edit/96217 Del: integrated -- https://master.php.net/note/delete/96217/integrated Del: useless -- https://master.php.net/note/delete/96217/useless Del: bad code -- https://master.php.net/note/delete/96217/bad+code Del: spam -- https://master.php.net/note/delete/96217/spam Del: non-english -- https://master.php.net/note/delete/96217/non-english Del: in docs -- https://master.php.net/note/delete/96217/in+docs Del: other reasons-- https://master.php.net/note/delete/96217 Reject -- https://master.php.net/note/reject/96217 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165983) next »