After reading the following posts I have a few questions:
How can I send and receive data to and from a URL, i.e. server side scripts, web services, etc?
Is it possible to send and recieve data from/to a MySql server?
I guess this is more of a PHP question so I still hope it applies here.
I was wondering if anyone knew of any examples of a php server side script that can accept unity GET request, extract out the parameters and then inset those parameters into a function (this function I will use to query my database)
From what I understand from the UNITY side, I can pass the URL + Parameters through the WWW class to initiate the GET request.
var url = "http://example.com/script.php?var1=value1&var2=value2";
WWW www = new WWW(url);
///And So on
So the question is how i set up my PHP script to be able to do something with this request.
I think I can start out with the following in my php script
<?php
if (isset($_GET['url']))
{
$url = $_GET['url'];
}
?>
Am I understanding this correctly that this will set $url to http://example.com/script.php?var1=value2&var2=value2 ?
If this is correct I should then be able to parse out my parameters into an array that I can feed into my query function. Using a series of string manipulators.
Once I have this array I should be able to feed them into my function:
<?php
function Query(value1, value2)
{
//do some awesome Query stuff
return result;
}
?>
Assuming I have everything right up until now, this is where I get stuck, How to I take the result of my function so that it get sent back to the www result of my unity script?