what is needed to get WWW Post working correctly

I have been trying for some time to get server interaction between a server, and Unity set up. I can do pulls(GETs) fine, but POST just does not work.

my question is what is needed both in terms of unity code, and server to make POST work. what I think so far is this:

Unity needs to know the base url, and then I need to have Unity give post information (but what do I give it to? the server directly, or a specific script on the server?). then the server returns a response.

what do I need server side, and what do I need Unity side to get the WWW class fully functional (and the documentation is funny at best as I have looked and don’t understand)

currently I just want to request a specific record see here for details

EDIT:

so I think I kind of understand, but correct this if it is wrong. in the server script there is to be a variable $inBoundData = $_POST["varName"];, and then in Unity I call out the post value string name with the WWWForm: form.AddField("varName, sentValue);

is this how I do this?

It needs the url to the script on the server. Ex: yourdomain.com is available for purchase - Sedo.com

The server needs to access the POST variables, ex: $_POST[‘myfield’]

To answer this question actually requires some background: a certain amount of information must be known about the target server/page (what verbs it expects for what actions, and what direct actions are available by direct communication with the server.

the WWW class only allows access to 2 web verbs at time of writing (GET/POST). if the action that you are attempting to perform requires another verb (PUT/DELETE…) then an intermediary script must be placed on the target in order to accommodate for this “lacking” (the script must allow for interactions, but must be written in such a way that if a hacker targets it that no real harm can be done)

when interacting with a server, or such directly then it is possible to send similar to commandline information through headers (similar to the first post here (keep in mind that this is only for things that take the POST verb), and you might need to do trial, and error on the formatting that the server is expecting such as a server that expects json for POST quarries may not take exactly formatted json, but it might be close. Such as mongodb for a POST request of data takes:

string rqData = "{searchField:\\""+searchKey+"\\"}";

when interacting with a script directly usually using the WWWForm class if there is only one script on the server then you do not absolutely need to call out the script specifically though my suggestion is to target the script directly unless you absolutely know that you don’t have to. in order to target a script directly (besides having the url go directly to that script) you need to know the signal word that the script expects for post data. when reading through say a php script these will be $_POST["singalWord"] and when constructing the form data through WWWForm.AddField() it would be AddField("signalWord", providedData) then just send the form with the WWW construtor. similar security considerations need to be given for these interaction as it is quite possible that interacting directly with a script on a server can supersede the securities of the server.