Transmission Line Noise

Dash­code and cURL

Wed, Sep 9, 2009

Need to get data from another site well you can use cURL to get it.
widget.system("/usr/bin/curl", null).outputString;
this will pull the rate as a json string, but as the site needs authen­ti­ca­tion it actu­ally won’t, it will fall over. In php i would set this up with curl_opt but in dash­code i am not able to use php.

How­ever run man curl and scru­ti­nise the options and you see
-u/--user <user :password></user>

sub­sti­tute the cor­rect infor­ma­tion and the string looks like this:-
widget.system("/usr/bin/curl --user johnh:aranaio", null).outputString;

and that does the trick.