log in using (get-url)?

For the Compleat Fan
Locked
cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

log in using (get-url)?

Post by cormullion »

I'm wondering if it's possible to log in to a web page using a call to (get-url). I'm not very knowledgeable about the completion of forms...

The URL is http://en.wikipedia.org/w/index.php?tit ... :Userlogin, but it would need a username and password too.

m i c h a e l
Posts: 394
Joined: Wed Apr 26, 2006 3:37 am
Location: Oregon, USA
Contact:

Post by m i c h a e l »

Yes, I came across this, as well, but I, too, was without a solution.

On a different note, I noticed the regular posters' last few posts going into this section, as opposed to the one I've been posting to. Should I post my Show and Tell's here, or there?


m i c h a e l

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

m i c h a e l wrote:On a different note, I noticed the regular posters' last few posts going into this section, as opposed to the one I've been posting to. Should I post my Show and Tell's here, or there?
Yes, there was a reorganisation some weeks ago, after some debate about where to post ((non-newLISP)-LISP) questions - and I was posting ((MacOS X) newLISP) questions in the Linux forum. The four fora were renamed:

http://www.alh.net/newlisp/phpbb/viewto ... =5459#5459

But there's still some slight doubt in my mind about whether to post in 1 or 4. It's the phrase 'newLISP talk in general', I think, that makes me wonder where to post a specific code-related question. I thought at the time that a semi-official channel for news and announcements was the main use for 1.

Luckily traffic is still leisurely enough that it's no problem!

m i c h a e l
Posts: 394
Joined: Wed Apr 26, 2006 3:37 am
Location: Oregon, USA
Contact:

Updates?

Post by m i c h a e l »

cormullion wrote:I'm wondering if it's possible to log in to a web page using a call to (get-url).
Was this question ever answered by anyone? cormullion, did you ever get any further on this? Just curious.


m i c h a e l

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

I'm wondering if it's possible to log in to a web page using a call to (get-url).
newLISP can do the equivalent of filling out a form with a user-name and password and send it back. You would do this with 'post-url' and there is a simple example in the manual. You would have to investigate the form posted of the specific website (with view source) you are dealing with to extract the correct variable names and URL for the CGI process.

If cookies are involved you can handle those too by using the "header" option which is described with more detail in the documentation about "get-url".

If you have to do a secure https:// post, things get more involved and I don't have a quick answer for this. You need to dig into documentation about SSL. HTTPS is plain HTTP over SSL encryption. You could perhaps import SSL libraries and do the encrytion yourself or you could use 'exec' and knit something together with the unix utility 'curl', which can handle SSL encryption.

Lutz

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Yes, it was the cookie part that has been puzzling me. I had got a reasonable way with it until I saw the cookie crumbling...

I never go anywhere without packing the newLISP manual, so I'll study it some more!

thanks

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

I never go anywhere without packing the newLISP manual, so I'll study it some more!
... and let me know if you find any bad English, I did a complete pass through the manual this week and found lots of little mistakes, typos, spelling errors, clumsy language and occasionally bad source code. The manual is for many the first impression when they get in kontact with newLISP.

End of his weekend development version 8.8.8 goes online with that reviewed manual. If you or Michael (or anybody else with superior English knowledge ;-) ) have any thing you would like to have expressed differently let me know before mid June. On June 20th release 8.9.0 will be out with a new PDF version of the manual.

Lutz

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Ok, I'll make a note of anything I see. But I can usually understand the manual fine. And if it had all the examples I ever wanted it wouldn't be a compact document any more!

On the (post-url) topic, I had got this far:

Code: Select all

(post-url 
		"http://en.wikipedia.org/w/index.php?title=Special:Userlogin"
		"action=submitlogin&wpName=blahblah&wpPassword=12345678"
		 )
which returns me a page saying that I have cookies disabled. I had no idea how to specify or enable cookies using post-url, or indeed how cookies work at all, so I gave up round about this point... !

m i c h a e l
Posts: 394
Joined: Wed Apr 26, 2006 3:37 am
Location: Oregon, USA
Contact:

Post by m i c h a e l »

Lutz wrote:... and let me know if you find any bad English, I did a complete pass through the manual this week and found lots of little mistakes, typos, spelling errors, clumsy language and occasionally bad source code.
Melissa and I are on it.

Lutz, how would you prefer us to submit revisions? We have Acrobat Pro, so we could review and comment directly in the PDF if that would be helpful.

m i c h a e l

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

yes, I think this would work. I could paste from the PDF into my text editor, which has the HTML file. I always edit the HTML file directly and then have a template in OpenOffice (NeoOffice) to convert it to PDF and then do a quick review of page breaks.

Is it possible for you to highlight your comments somehow, so I could easilyt identify them?

In any case, just do what works best for you, just give me a way to identify the edited stuff.

I posted the version closest to what goes online tomorrow here: http://newlisp.org/michael/newlisp_manual.html As a Mac user you know how to get it PDFed, if that is your preferred format for editing/review.

I am just starting the letter 'O' for 'open' and hope to be through to 'Z' for 'zero?' with my own review tomorrow.

Thanks to you and Melissa for helping!

Lutz

ps: to Cormullion: don't have an answer at the moment, this needs more research, but there are cookie examples in the description for 'get-url'

Locked