Getting data from a secure web page

Dave Cragg dave.cragg at lacscentre.co.uk
Wed Feb 3 06:04:36 EST 2010


On 3 Feb 2010, at 10:54, Sarah Reichelt wrote:

> On Wed, Feb 3, 2010 at 8:40 PM, Dave Cragg <dave.cragg at lacscentre.co.uk> wrote:
>> Sarah
>> 
>> Not quite sure what you're wanting to do. Do you just want to get the html page normally returned after login from within a Rev script?
> 
> Yes. That way I can get the data automatically, without having to log
> in manually with my browser.
> 
>> 
>> If so, does this work?
>> 
>> on mouseUp
>>  libUrlSetSSLVerification false ## SEE BELOW 1
>>   put "https://memberservices.optuszoo.com.au/login/" into tUrl
>>   put "Action=login&username=abc&password=abc" into tPostData ##SEE BELOW 2
>> 
>>   post tPostData to url tUrl
>>   put it into field 1
>>   if the result <> empty then
>>      answer the result
>>   end if
>> end mouseUp
>> 
>> Point 1
>> libUrlSetSSLVerification false does as Bernard says, and no check is made of the certificate. (But data is still sent encrypted) Better to set the sslCertificates to a suitable file if you have one.
>> 
>> Point 2
>> Change the "abc" for username and password to the correct values. (URLEncode if they contain funny characters or spaces)
>> 
>> When I tried it, it returned the login page again but with the "Incorrect username/password." text included, which suggests it might be doing something right.
> 
> 
> If I try with the wrong login details, I get that "Incorrect
> username/password." page, but if I use my real login details, I get no
> page, but the result is "error 302 Moved Temporarily".

What happens if you try "get" instead of "post"

get url "https://memberservices.optuszoo.com.au/login/?Action=login&username=abc&password=abc"

(Not sure about that final forward slash.)

libUrl will follow redirects (the 302 response) when using "get" but not "post"

If it won't accept "get", look in the headers returned from "post" (using libUrlLastRhHeaders()) and try to find the "Location:" header. With a bit* of luck, it will contain the URL with the data you need. (* maybe a lot of luck)

Cheers
Dave


More information about the Use-livecode mailing list