What am I doing wrong?
Im trying to keep this simple. Comment or use the Community Chat to ask me questions!
local Data={ token = "adgdrharhartjartjajtrjartjartj", user = "atjhartjrjsryjsyjtdyjsdt", title= "Testing", message= "HERRO" } game:GetService("HttpService"):PostAsync("Website",Data)
A few important points I need to make. Use JSON and :PostAsync() requires 3 arguments.
ALSO.. You need to understand PHP, JSON, HTML5 before anything. http://php.net/manual/en/intro-whatis.php
As well you need a webserver that is encoded in PHP and MySQL. (Must be HTTP/SSL enabled)
Links:
JSONDecode: If you have something which has been JSON encoded, such as ["a","b","c"], you can use this method to decode it into a Lua table.
myJSON = [=[["a","b","c"]]=] hs = game:GetService("HttpService") myTable = hs:JSONDecode(myJSON) -- Yields a variable myTable table that looks like {"a", "b", "c"}
JSONEncode:
HttpService = game:GetService("HttpService") mytab = {"a","b","c"} print(HttpService:JSONEncode(mytab))
Now, your code.. Lets fix this up shall we? :D
local Http = game:GetService("HttpService") local JSON_Type = Enum.HttpContentType.ApplicationJson --[[ Theres a few different types.. ApplicationJson ApplicationXml ApplicationUrlEncoded TextPlain TextXml (Default is Enum.HttpContentType.ApplicationJson, highly recommended to add anyways though) ]]-- local Url = "www.example.com" local Data = { token = "abc"; user = "abcd"; title = "abcde"; message = "Hello!" } local JSON_String = Http:JSONEncode( Data ) local Returning_post = Http:PostAsync(Url, JSON_String, JSON_Type) print(Returning_post)