HttpPost (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy
No edit summary
>LocalChum
No edit summary
 
(14 intermediate revisions by 5 users not shown)
Line 2: Line 2:
<onlyinclude>{{Method
<onlyinclude>{{Method
|name = HttpPost
|name = HttpPost
|arguments = [[string]] ''URI''
|arguments = [[string]] ''url'', [[string]] ''data'', [[bool]] ''synchronous'' = false
|returns = [[string]] ''request body''
|returns = [[string]] ''response''
|description = Sends data over a URI via HTML post method.
|description = Sends data over a URI via HTML post method.
|object = DataModel
|object = DataModel
|protected = yes
}}</onlyinclude>
}}</onlyinclude>


Line 11: Line 12:


{{Example|
{{Example|
If using the [[Command Bar]] or a [[CoreScript]]...<pre>
-- Correct security context will allow you to post variables to an HTML document.
print( game:HttpPost( "http://www.roblox.com/User.aspx?ID=4812582" ) ) --> s HttpGet</pre>
If using a [[Script]] or a [[LocalScript]]...<pre>
game:HttpPost("<nowiki>ht</nowiki>tp://somesite/", "ThisIsTheDataThatIsPOSTed"); --> However, in Roblox, only external code can do this type of data POSTing, so you will get an error saying "s HttpPost"
print( game:HttpPost( "http://www.roblox.com/User.aspx?ID=4812582" ) ) --> s HttpGet
}}
</pre>}}


[[Category:Methods]]
[[Category:Methods]]

Latest revision as of 23:03, 9 August 2011

Protected:This item is protected. Attempting to use it in a Script or LocalScript will cause an error.
HttpPost( string url, string data, bool synchronous = false )
Returns string response
Description: Sends data over a URI via HTML post method.
Member of: DataModel


Example
-- Correct security context will allow you to post variables to an HTML document.

game:HttpPost("http://somesite/", "ThisIsTheDataThatIsPOSTed"); -->  However, in Roblox, only external code can do this type of data POSTing, so you will get an error saying "s HttpPost"