How can i do a http request to firebase?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
k1ngS4krifice
Prole
Posts: 10
Joined: Fri Aug 12, 2022 3:27 pm
Location: Mexico

How can i do a http request to firebase?

Post by k1ngS4krifice »

I'm trying make a http request to my firebase realtime database using lua but don't work and i don't know why. This is the code i use:

Code: Select all

local http = require("socket.http")
local json = require "json"

local body, code, headers, status = http.request {
  method = "POST",
  url = "https://test-d4421-default-rtdb.firebaseio.com/data.json",
  headers = {
   ["Content-Type"] = "text/plain",
   ["Accept-Encoding"] = "gzip",
   ["Connection"] = "keep-alive",
   ["User-Agent"] = "love2d",
   ["Accept"] = "*/*"
   },
  source = ltn12.source.string(json.encode({nombres = "pablo"}))
}

print(code) -- closed
print(body) -- nil
The "code" returns me a "closed". I do the same with Postman and works.

Those are the only modules i use because the others modules needs install luarocks in windows and i tried to install it but don't works, so i used those modules but if another is better please tell me. But i think i'm not setting well something or i miss something. Please help me :c
User avatar
zorg
Party member
Posts: 3435
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How can i do a http request to firebase?

Post by zorg »

> url = "https://

socket's http implementation does not support https.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: How can i do a http request to firebase?

Post by Bigfoot71 »

My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 19 guests