• Best way to store http.Post data
    2 replies, posted
I'm currently using http.Post to post the server's title and IP address into a file on my webserver (to track who is using my addon) but i've set it to create a new file per server to stop the file being overwritten everytime somebody new uses the addon. This is the code i'm currently using, does anybody have any suggestions on how I can save all data to one file without it wiping all previous data when new data is posted? <?php $p = $_POST["p"]; $a = $_POST["a"]; $addon = $_POST["addon"]; $f = fopen("$p.html", "w"); fwrite($f, "$addon $p $a\n"); fclose($f); ?> http.Post( "http:/hiddenurl/gmod/post.php", { addon = "My addon name", a = tostring(GetHostName()), p = game.GetIPAddress() }, function( result ) if result then end end, function( failed ) end) I've tried writing them all to one file but it wipes all previous data. Thanks
This is more of a php question than a lua question but in your fopen you need to set the mode to 'a' instead of 'w' PHP: fopen You can also store the data via sql using things like pdo for php
Sorry, you need to Log In to post a reply to this thread.