LuaSocket question
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

LuaSocket question

Started by TTB, 22 July, 2015, 17:21:16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TTB

I'm have a question about luasocket.
Little 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,
	}


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 0.4.1.1 and LuaSocket 1.22 (regarding the html.lua code)
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

TTB

Hmm regarding this post it works as designed: http://stackoverflow.com/questions/17372330/lua-socket-post
The body of the page can't be resolved by using headers it seems. Or....  am I wrong.   :ermm:
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

TTB

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...
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

SMF spam blocked by CleanTalk