newLISP Fan Club

Forum => newLISP in the real world => Topic started by: hilti on November 03, 2009, 01:11:54 PM

Title: Exec, cURL for accessing Google Analytics API
Post by: hilti on November 03, 2009, 01:11:54 PM
Hi



I need some help in accessing the Google analytics data API. My problem is:



;; use of curl because newLISP get-url doesn't work with HTTPS
;; save response token
(set 'token (exec "curl 'https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&service=analytics&Email=user@gmail.com&Passwd=mysecretpasswd' "))
(print token)


This way I got a string back from Google for authentication. But how Do I replace Email and Passwd with variables? I don't get it. I tried this:



;; use of curl because newLISP get-url doesn't work with HTTPS
;; save response token
(set 'email "user@gmail.com")
(set 'passwd "secret")
(set 'token (exec "curl 'https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&service=analytics&Email='"email"'&Passwd='"passwd"' "))
(print token)


Thanks for help!
Title: Re: Exec, cURL for accessing Google Analytics API
Post by: Kazimir Majorinc on November 03, 2009, 01:27:11 PM
Use append?
Title: Re: Exec, cURL for accessing Google Analytics API
Post by: cormullion on November 03, 2009, 01:57:55 PM
How about:


(set 'token (exec (string "curl 'https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&service=analytics&Email=" email "&Passwd=" passwd "'")))

or append, or format...?
Title: Re: Exec, cURL for accessing Google Analytics API
Post by: hilti on November 03, 2009, 10:21:12 PM
Thanks everyone. I was a blockhead.



I'll publish the script when it's ready.



Cheers

Hilti