Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Http::geturl when password is needed 1

Status
Not open for further replies.

TuN

Programmer
Sep 16, 2002
2
0
0
SE
Hi!

How do I do to if I want to use Http::geturl on i site that is password protected? (I do have a login and a password, and just wants to make a script for automatic information evaluation of the site).

I'm a real beginner in TCL..

 
This is discussed on the Tcl'ers Wiki ( specifically on the page "http," Here's an example that D. J. Hagberg posted on that page:

Code:
proc geturl_auth {url username password} {
    set auth "Basic [base64::encode         $username:$password]"
    set headerl [list Authorization $auth]
    set tok [http::geturl $url         -headers $headerl]
    set res [http::data $tok]
    http::cleanup $tok
    return $res
}
- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
That's a big help for more than the OP. I still find the wiki a little hard to navigate on some topics.
 
I'm rather sure that the suggested approach don't work in my case. I want access to a site that work like for example the Yahoo mail site in Sweden. Even if you are not regular visitors to that site I'm sure you know the style :eek:).

You get to a login site, types in your username and password and then it looks like you get some sort of "random" code that gives access to your mail site. What I want to do is to call the login site pass my login and password and than get my temporary code and continue to call the real site. I'm not sure that it works the way I think, plz correct me if I'm wrong. And how should I do to do what I want?
 
Hm. That's going to be a lot more complicated, and you're going to need to know a lot more about how the site's implemented to pull it off.

Most likely, access is being granted through forms. When you type the login and password into text entries on a web page, that information is sent back as form data, using either a GET or POST HTTP protocol. Then the web server either sends your browser some sort of cookie, or else passes an authorization token as an invisible form value on all subsequent page accesses.

So, to get this automated from a script, you're going to have to know what the various form fields are on the pages, the data format required on them, and how to properly handle the authorization token, whatever form it might take.

That's about all I know about the subject, as I've not tried serious Tcl automation of form-based HTTP sessions. The other information provided on the Wiki page might get you started, or you might ask for help on the comp.lang.tcl USENET newsgroup, to see if someone there has tried something similar to what you're attempting. (You can access Google Groups at to read and search the comp.lang.tcl newsgroup.) - Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top