Making newLISP get-url work with http basic auth

Q&A's, tips, howto's
Locked
ax0n
Posts: 19
Joined: Thu Feb 01, 2007 3:03 am

Making newLISP get-url work with http basic auth

Post by ax0n »

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.

Code: Select all

(set 'hedr (append "Authorization: Basic " (base64-enc (append user ":" pass)) "\r\n\r\n"))
(set 'contents (get-url url 5000 hedr))
 
Hopefully, this helps some people. I don't like relying on external programs if I can avoid it.

Locked