Game Development Community

How would you send multiple queries using HTTPObject in TS?

by Benton Lam · in Torque Game Engine · 09/10/2008 (4:27 pm) · 6 replies

The function is defined in HTTPObject as follows:

post(%address, %requestURI, %query, %post);

And somewhere, someone demonstrated the use of a single query variable and data
What if I want to send multiple queries to the same URI?
e.g. http://%address/%requestURI?var1=post1&var2=post2&...&varN=postN

How would I be able to do that?

Would it be a vector of words for both %query and %post?

I have the Multiplayer Gaming and Engine Coding and Advanced 3d Game Programming, looked on google and on the TDN, with no real answer...

About the author


#1
09/10/2008 (8:16 pm)
Do you use php?
#2
09/10/2008 (8:23 pm)
It's going to talk to php, but I didn't write it.
#3
09/11/2008 (9:47 am)
Looking at the httpObject source in TGE 1.4,
i don't see that the %post parameter actually does anything.
can anyone confirm ? (ie, the mPost member of HTTPObject is initialized & filled w/ data, but never used. unlike mQuery, which is used in onConnected().)

however,
Benton, i think you shouldn't have much trouble doing the request you want.
just pass in the entire string "var1=post1&var2=post2&...&varN=postN" as the query parameter.

also i would also use get() instead of post() just for clarity.
#4
09/11/2008 (10:28 am)
Well technically I need to send a post to the server, would that be a problem?
#5
09/11/2008 (12:30 pm)
I confess i have a non-formal understanding of the differences between posts and gets,
but my working understanding of them is that in practice there really isn't any difference unless you're sending more data than can fit in the URL. .. which according to the HTTP spec, the URL has no maximum size, but in reality it does.

i can't go into too much detail here on the TGE source code, since this is a public forum,
but it sure looks to me like HTTPObject's post() method is identical in every way to its get() method except that post() has an additional and entirely unused parameter.
and specifically, they're both using GET in the http protocol.
#6
09/12/2008 (8:56 am)
It's safe to say you can get 1024 bytes into the arguments to a webscript, but whether you can fit more depends on the server and script language.

As suggested in the spec, GET is for retrieving data (no complicated arguments), and POST is for submitting. I think at least for PHP the POST data size and file upload limit are the same setting. Default is 4-8MB.