How can I save a file with a string on the client's device using php?
$handle = fopen("newfile.txt", "w+");
$txt = "string";
$content = fwrite($handle, $txt);
Think that you actually cannot write files on the client's device, but you could follow this steps to have a similar result.
Write a file with the string you want on the server side
Download the file
Delete the file from server
Hope this helps