- Home /
WWW Form comparison question
Hi, right now I'm trying to create a system where my game can send values to a website and open it with a press of a button (where the value will be display). I'm looking at using Form which seems to be the way to go, but I'm wondering if Form is the same as "post method" in PHP?
I'm checking some tutorial around the web regarding PHP/HTML forms and seems like the value the player inserted can easily be change in the url instead. For example:
"http://www.somesite.com/action_page.php?firstname=Mike&lastname=Manner"
The value of firstname and lastname can easily be change by editing the url. Is using WWW Form would resulted in the same way?
Answer by spiceboy9994 · Apr 16, 2015 at 06:09 PM
The method you describe to send the parameters within the url is a Http GET request, and that's usually called to get data from a web server. The class that unity provides to execute a GET is the WWW class. I've read that if you send extra data to the request is automatically converted to a POST request, but I haven't checked that yet.
The WWWForm is used to execute Http POST requests. By dafault, the POST request data is not sent on the url, but as the request body. You can download a sniffer to understand a bit more about how data are sent in different ways from a GET Request and from a POST request (like fiddler).
http://www.telerik.com/download/fiddler
However, if you're sending information to a web server, and the information is sensitive, using a sniffer the POST is also vulnerable (not as easy as changing values within the url), but it can be modified. So there are several layers of security that you could apply to the web communication, from communicating through https, to encrypting data. I'm really familiar with web programming, ping me if you need more info about all this.
Regards
Thanks for explaining, all this is totally new to me. After talking with the person that will handle the web stuff, we're thinking of changing the way the thing goes, which is sending the value first and opening the website later ins$$anonymous$$d of doing it in 1 go. This way the website will take the value from the database ins$$anonymous$$d (which I think may be a more proper way).
I'm wondering if you know whether this will require the game to use SQL or not? Since I'm using the free version, I remember not being able to use the dll needed for SQL before. From the examples and other questions I've seen, seems like it doesn't need it since SQL will be handle by the server side between the PHP and database.
That's correct, if you are thinking to have a Web Server to respond the game data requests, then you need to write database access on your Php code. Since Unity is a client technology, you can connect to any webserver that respond / receives data (Php, $$anonymous$$VC, Ruby, NodeJs, etc). In all the cases, the database access code should be written on the backend server code.