Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with http :l?

local httpService = Game:GetService("HttpService");
local url = "https://code.stypi.com/8vi0ntes"
local body = "rbxVar=" .. httpService:UrlEncode("lel roblux")
httpService:PostAsync(url, body, Enum.HttpContentType.ApplicationUrlEncoded)



its giveing a
 07:11:23.585 - Error response:  
07:11:23.587 - HTTP 403 (Forbidden)


3 comments

0

Are you sure this output is directly related to your script? If so, have you enabled HttpService?

0

yes and yes

0

Stypi is broken, plus you cant use postasync on stypi; postasync would work with github,pastebin.. but pastebin you will have to use A LOT more code to post.

1 answer

Turning on HttpService is quite easy. In ROBLOX Studio, look at your top menu bar. Press Insert -> Service -> HttpService. Once you locate HttpService under the Explorer window, find HttpEnabled under Properties. Set this to true (check the box).

Here's example on how to use it in a script:

--Simple Example of a GET request sent to example.com
hs = game:GetService("HttpService")
test = hs:GetAsync("http://example.com", true)
-- test now contains the html text representation of example.com.

PostAsync

string PostAsync (
    string url,
    string data,
    HttpContentType content_type = ApplicationJson
)

Watch this for more help: http://m.youtube.com/watch?v=4u4pq_8muck

3 comments

0

im trying to post not get

0

Ah, sorry.

0

Edited my answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.