I would like to save a JavaScript variable value in a file.
For example,
<script>
    var ref = document.referrer;
</script>
I would like to save the variable ref value in a text file using PHP.
<?php
    $file = fopen("ref.txt", "a+") or die("Unable to open file!");
    fwrite($file, ref);
    fclose($file);
?>
How can I do it?
 
     
    