Below is my script. It is supposed to receive the players name, the time it took them to complete a task, and whether of not they completed it it all. I am only looking to make a simple text file on the server, hoping to avoid sql.
import System;
import System.IO;
var playerName;
var time=0;
var fileName = "file1.txt";
var url = "file:///c://Users/Greg/Desktop/jdofoenfo/Project 1/test.php?";//call php script from here
function Start()
{
playerName=PlayerName.pName;
var post_url = url + "name=" + playerName + "&score=" + time;
var www : WWW = new WWW (post_url);
yield www;
/* //write to local file
playerName=PlayerName.pName;
var sr = File.CreateText(playerName);
sr.WriteLine ("more infoe");
sr.Close();
*/
}
Below is the php script. I dont really understand much, but it shoudl be relatively simple and I believe it should look something like this.
<?php
$file = ‘data.txt’;
$name=($_GET['name'])
$timePassed=($_GET['time'])
// Write the contents back to the file
file_put_contents($file, $name,$timePassed);
?>
When the game runs, nothing happens. There aren’t any errors, but I am obviously doing something wrong.