lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Paul

I downloaded luasec, and hit the usual type of problem I get with Lua.  (I like Lua, but this is my pet peeve with it !)

This library doesnt appear to have a windows binary available.  So I have to build it myself, with not very good build notes.

I then discover it uses openssl C library, so I now have to figure out where to download openssl and which version I need to get to be compatible, and where all the files need to go to build it etc etc.

What sounded like a quick Lua script is already not straightforward and probably more hassle than just writing this in C# in the first place.  ( I could probably find a well documented online example of how to do this for C#)

I wonder if I could  snag the luasec  *.lua files and *.dll file I need from my  Zerobrane Studio installation ?
That might be a simpler solution ?

Geoff

________________________________________
From: lua-l-bounces@lists.lua.org <lua-l-bounces@lists.lua.org> on behalf of Paul K <paul@zerobrane.com>
Sent: 24 November 2015 20:03
To: Lua mailing list
Subject: Re: How to get a webpage with Lua Socket ?

Hi Geoff,

> local webText = http.request([[https://www.betfair.com/exchange/]])

You should be using https.request (note *https*) after you do "local
https = require("ssl.https")". http.request actually connects to port
80 (so it does http:, even though it looks to you like https:) and you
get redirected to https:, which looks like the same URL.

Paul.

On Tue, Nov 24, 2015 at 11:47 AM, Geoff Smith <spammealot1@live.co.uk> wrote:
> Hi
>
>
> I have used Lua ocket to get a few web pages downloaded in the past without
> a problem, but have hit a snag with a specific webpage I am trying to
> download.
>
> I am trying to extract some data from the Betfair homepage.
>
>
> local webText = http.request([[https://www.betfair.com/exchange/]])
>
>
> I get back a small chunk of html which contains the text "The document you
> requested has moved to a new location.  The new location is
> "https://www.betfair.com/exchange/";
>
>
> This is the exact url link I passed to the function, so cant understand why
> the problem is occurring.  If I view that site in any browser it displays
> the full web page without needing me to register or login or anything like
> that.
>
>
> So the Server is detecting I am not using a browser and not giving me the
> page I require. I have tried tinkering with the headers sent by LuaSocket to
> make it look more like a Firefox request but to no avail.
>
>
> Could anyone offer a suggestion as to what I need to do to fix this problem
> please.
>
>
> Thanks for any assistance.
>
>
> Regards Geoff