Qwertygiy
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 89 |
|
|
| 29 Jan 2014 08:06 PM |
| I am experimenting with HTTPService and I have figured out how to use GetAsync just fine to communicate between my website and Roblox. However, I cannot quite figure out how to get PostAync to work. Could someone please give me a working example of how to, say, post the value "Qwertygiy" under the key "name", so that in PHP, $_POST["name"] will answer as "Qwertygiy"? |
|
|
| Report Abuse |
|
|
Qwertygiy
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 89 |
|
|
| 29 Jan 2014 08:52 PM |
| I dislike bumping but I would really like an answer to this tonight if at all possible. |
|
|
| Report Abuse |
|
|
Qwertygiy
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 89 |
|
| |
|
|
| 30 Jan 2014 09:47 AM |
data = { arg1 = "test1", arg2 = "test2" } dataJSON = hs:JSONEncode(data) result = httpService:PostAync("[Website]",dataJSON) print(result) -- Returns the website content |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2014 09:48 AM |
Whops did something wrong.
data = { arg1 = "test1", arg2 = "test2" } dataJSON = httpService:JSONEncode(data) result = httpService:PostAync("[Website]",dataJSON) print(result) -- Returns the website content |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2014 11:52 AM |
| game:GetService("HttpService"):PostAsync("http://blahblah.com", "Qwertygiy=123", 2) |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2014 11:54 AM |
| But you should make all of your user inputted data URL safe: http://wiki.roblox.com/index.php/UrlEncode_(Method) |
|
|
| Report Abuse |
|
|
Qwertygiy
|
  |
| Joined: 09 Aug 2009 |
| Total Posts: 89 |
|
|
| 30 Jan 2014 02:52 PM |
| Thank you everyone; I did manage to find the answer in a Google search (go figure, Roblox search was useless) and figured out that the data format is "key=value&key2=value2". |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2014 06:11 AM |
| You can use this, but then you have to set the appropriate data type in the the PostAsync method. (Which is 2 BTW.) The default data type is JSON. |
|
|
| Report Abuse |
|
|
echoLua
|
  |
| Joined: 26 Jan 2014 |
| Total Posts: 321 |
|
|
| 31 Jan 2014 06:15 AM |
| Make sure to htmlspecialchars the POST value after you check if it exists. XSS exists. |
|
|
| Report Abuse |
|
|