Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help with HTTPS?

Asked by
sigve10 94
8 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

Hello there, nice person who spent their time checking this question! I was wondering about Http Service, as I have been trying to learn it. I understand how to retrieve information and finding webpages, but I do not understand how to use the information. Could someone try explaining how to use the information retrieved from a webpage using Http Service I am lucky enough to have gotten help through the community chat, but I still find it hard to understand how to retrieve more than one type of information. For example, if I want to get all the recent questions from the question page, what would I need to do to find the parts that are necessary?

0
What do you want to accomplish? If you don't have a clear purpose in mind for using HttpService, you don't need it. BlueTaslem 18071 — 8y
0
FYI: "HTTPS" is a protocol related to HTTP. Say "HttpService" if that's what you mean. BlueTaslem 18071 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

HttpService

Here's the relevant parts from the Wiki and CrescentCode documentation. Because we could


JSONDecode

JSONDecode(
    string JSONString
) -> var DeserializedData

Deserializes a JSON-formatted table into a Lua table. This is important when processing returns from requests to APIs because most APIs return their data in JSON format, and this allows you to interact with it natively.

Example usage

local HttpService = game:GetService 'HttpService'

-- Make a GET request to httpbin.org/get
local GetData = HttpService:GetAsync('http://httpbin.org/get');

-- Decode our data
GetData = HttpService:JSONDecode(GetData);

-- Take a look at the GET request we just sent
print("GET origin:", GetData.origin)

On the off chance that you're not retrieving data from an API source, you'd better start looking into string manipulation and the relevant patterns. The reason for this is that you're going to mostly be out of luck when parsing HTML without any knowledge of string manipulation.

Alternatively, you can use a third-party parser, but expect it to have tricky dependencies, some of which may be unsatisfiable.

Ad

Answer this question