Why isn't this $_POST working properly?

Howdy, y’all! I was doing something today and seem to be having trouble simply uploading a WWWForm with post info. It’s been pretty frustrating and I can’t figure out why ha ha. The goal is to send a string from Unity to a PHP file, and that PHP file writes the string to a file called “newFile.txt”

This is happening in Unity:

IEnumerator UploadMetrics(string inMetrics) {
		WWWForm form = new WWWForm();
		form.AddField("action", "telemetry");
		Debug.Log (inMetrics);
		form.AddField("metric", inMetrics);
		//uploadUrl is a string like "http://mywebsite.com/upload.php"
		WWW w = new WWW(uploadUrl,form);
		yield return w;
		if (w.error != null) {
		} else {
			Debug.Log ("Successful Upload!");

While this is happening in PHP:

if ($_POST) 
    if ( isset ($_POST['action']) ) 

       if($_POST['action'] === "telemetry") 
           $thetext = $_POST['metric'];
            $myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
            fwrite($myfile, $thetext);




I’ve done similar stuff a million times before, generally with interacting with databases via SQL, but for some reason I’m just not seeing what I’m doing wrong. Any ideas?

Thanks so much!

Found the answer: while “http://mywebsite.com/upload.php” will resolve and give some feedback that it was successful (that is, no w.error), it needs “www” in the url to actually be sent to the right place.

So, in conclusion, the solution to my code above is to set the “uploadUrl” variable to something like: “mywebsite.com is available for purchase - Sedo.com