generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How do I use PostAsync properly?

Previous Thread :: Next Thread 
Qwertygiy is not online. 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 is not online. 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 is not online. Qwertygiy
Joined: 09 Aug 2009
Total Posts: 89
30 Jan 2014 09:09 AM
Bumping again.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
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
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
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
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
30 Jan 2014 11:52 AM
game:GetService("HttpService"):PostAsync("http://blahblah.com", "Qwertygiy=123", 2)
Report Abuse
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
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 is not online. 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
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image