Development Section > Your Developing Problems

LuaSocket question


I'm have a question about luasocket.
Little code:

--- Code: ---local socket = require"socket"
local http = require("socket.http")

-- Example 1
local s,fd = "",http.request(myFeed)
-- Example 2
local headers = {["user-agent"] = "Something"}
local r, c, h = http.request {
method = "HEAD",
url = myFeed,
headers = headers,

--- End code ---

On example 1, I get the plain HTML code, which in this case doesn't work anymore on the site I use it because it needs a user agent. So I've added a user agent and my new situation is example 2. Unfortunatly I get on string c the "200" status and not the HTML code I want te receive.

How do I get the behaviour like example 1 and using a spoofed user agent header?
Using PtokaX and LuaSocket 1.22 (regarding the html.lua code)

Hmm regarding this post it works as designed:
The body of the page can't be resolved by using headers it seems. Or....  am I wrong.   :ermm:

OK fixed it... I've eddited the html.lua and replaced the default user agent into something I like, such as IE11 or Chrome or Firefox...


[0] Message Index

Go to full version