Hi I was wondering how to read the contents of a tempname file? I cant seem to access the data added in the example below.
$tmpfname = tempnam("/tmp", "testfile");
$handle = fopen($tmpfname, "w");
fwrite($handle, "I stored data");
echo fread($handle, 1024); / read file?
fclose($handle);
unlink($tmpfname);
This example works however i'm not able to give the temp file a name which I need to do so I can call it at a later date using CURL.
$temp = tmpfile();
fwrite($temp, "writing to tempfile");
fseek($temp, 0);
echo fread($temp, 1024);
fclose($temp); // this removes the file
Thanks