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

How do you get individual lines from a webpage using httpservice?

1 answer

You can do this:

local http = game:GetService("HttpService") 
http.HttpEnabled = true 
local page = http:GetAsync("https://pastebin.com/raw/78VT3MUS") 
print(page)

It sets HttpEnabled to true so that it's allowed to get the page, then gets that page with GetAsync.

(You have to turn on HTTP requests in your game settings for it to properly work)

edit: SHOOT I DIDN'T READ THE QUESTION RIGHT TRY THIS:

local lineNumber = 1
local http = game:GetService("HttpService") 
http.HttpEnabled = true 
local page = http:GetAsync("https://pastebin.com/raw/78VT3MUS") 
local function parse(s) -- stole this, sorry ScriptGuider
    local t = {};
    for chunk in string.gmatch(s, "[^\n]+") do
        t[#t+1] = chunk;
    end;
    return t;
end;
local foundPage = parse(page)
print(foundPage[lineNumber]) -- line1

4 comments

0

I know how to use getasync but how do I get individual lines?

0

yeah you really didn't answer his question

0

also, what the hell is http.HttpEnabled? that doesn't work!

0

sorry, tried again

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