Autofill Script For A Linked Website

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
johnmiller1950
Posts: 113
Joined: Mon Apr 30, 2007 3:33 pm
Location: Dalton, Ohio

Autofill Script For A Linked Website

Post by johnmiller1950 » Mon May 07, 2007 5:12 pm

Greetings All,

I am writing a program in which the user enters his user name and password for a specific website in the preference file of my application.

Currently, I have a link to the home page of the website. What I would like to do is automatically have my program log the user in to the website so he/she can begin using it without having to manually log in.

Is this possible?

Thanks!
John Miller

xApple
Posts: 113
Joined: Wed Nov 29, 2006 10:21 pm
Location: Geneva

Post by xApple » Mon May 07, 2007 7:07 pm

Depends on how the site is made. Sometimes it's just a matter of executing a "POST" command to the site in question. Othertimes, it can be more tricky; for instance I remember doing it for a site that had a timestamp imbedded in the page which you had to find and send back to log in. I can give you the stack that I made back then; but the core code was approximately this:

Code: Select all

    put "http://www.ogame.fr/" into myURL
    load URL myURL
    put findPram(format("<frame src=\"http://"),myURL) into frontPageURL
    load URL frontPageURL
    put findPram("timestamp",frontPageURL) into timeStamp
    --
    put "login=" into postData
    put fld "nickname" of cd 1 of stack "ogame" after postData
    put "&" after postData
    put "pass=" after postData
    put fld "pwdReal" of cd 1 of stack "ogame" after postData
    put "&" after postData
    put "timestamp=" after postData
    put timeStamp after postData
    --
    POST postData to thePHPurl
    put it into logedPage

Post Reply

Return to “Talking LiveCode”