log in using (get-url)?

Started by cormullion, April 28, 2006, 08:09:21 AM

Previous topic - Next topic

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?title=Special:Userlogin">//http://en.wikipedia.org/w/index.php?title=Special:Userlogin, but it would need a username and password too.

m i c h a e l

#1
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

#2
Quote from: "m i c h a e l"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/viewtopic.php?p=5459#5459">//http://www.alh.net/newlisp/phpbb/viewtopic.php?p=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

#3
Quote from: "cormullion"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

#4
Quote
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

#5
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

#6
Quote
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

#7
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:


(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

#8
Quote from: "Lutz"... 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

#9
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">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'