Making newLISP get-url work with http basic auth
Posted: Sat Jan 17, 2009 5:03 pm
I mentioned getting newLISP working with twitter in passing on HiR, and it came up to use wget when you need user/password pairs for HTTP Basic Auth. I came up with this to create a working Basic Auth header for get-url. You must set 'url 'user and 'pass first, obviously.
Hopefully, this helps some people. I don't like relying on external programs if I can avoid it.
Code: Select all
(set 'hedr (append "Authorization: Basic " (base64-enc (append user ":" pass)) "\r\n\r\n"))
(set 'contents (get-url url 5000 hedr))