note 69419 added to function.tmpfile
| From: | php-general at lists dot php dot net | Date: | Tue, 05 Sep 2006 18:53:35 +0000 |
| Subject: | note 69419 added to function.tmpfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116716@lists.php.net to get a copy of this message | ||
By the way, this function is really useful for libcurl's CURLOPT_PUT feature if what
you're trying to PUT is a string. For example:
/* Create a cURL handle. */
$ch = curl_init();
/* Prepare the data for HTTP PUT. */
$putString = "Hello, world!";
$putData = tmpfile();
fwrite($putData, $putString);
fseek($putData, 0);
/* Set cURL options. */
curl_setopt($ch, CURLOPT_URL, "http://www.example.com");
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $putData);
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($putString));
/* ... (other curl options) ... */
/* Execute the PUT and clean up */
$result = curl_exec($ch);
fclose($putData);
curl_close($ch);
----
Server IP: 216.194.113.175
Probable Submitter: 65.57.245.11
----
Manual Page -- http://www.php.net/manual/en/function.tmpfile.php
Edit -- https://master.php.net/note/edit/69419
Del: integrated -- https://master.php.net/note/delete/69419/integrated
Del: useless -- https://master.php.net/note/delete/69419/useless
Del: bad code -- https://master.php.net/note/delete/69419/bad+code
Del: spam -- https://master.php.net/note/delete/69419/spam
Del: non-english -- https://master.php.net/note/delete/69419/non-english
Del: in docs -- https://master.php.net/note/delete/69419/in+docs
Del: other reasons-- https://master.php.net/note/delete/69419
Reject -- https://master.php.net/note/reject/69419
Search -- https://master.php.net/manage/user-notes.php