/* Poor man URL reader in Picat. This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ % import util. % import cp. main => go. go => URL="http://fx.priceonomics.com/v1/rates/", C=read_url(URL), println(C), nl. % % Version 0.1 of Picat don't support read_url, % so here's a poor man's versions of it, % using curl to fetch the file. % read_url(URL) = Content => Tmp = "read_url_tmp.txt", URL2 = "curl -s " ++ URL ++ " -o " ++ Tmp, _=command(URL2), read_file_chars(Tmp) = Content.