clifton
01/25/2018, 6:30 PMimport curl.*
fun main(args: Array<String>) {
println("Download from URL")
val url = "https://jetbrains.com"
val curl = curl_easy_init();
var result :CURLcode;
result = curl_easy_setopt(curl, CURLOPT_URL, url);
if(result != CURLE_OK) {println("Error setting URL for download: ${curl_easy_strerror(result)}"); return;}
result = curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
if(result != CURLE_OK) {println("Error setting CURL FOLLOWLOCATION option to true for download: ${curl_easy_strerror(result)}"); return;}
result = curl_easy_perform(curl);
if(result != CURLE_OK) {println("Error performing CURL download: ${curl_easy_strerror(result)}"); return;}
curl_easy_cleanup(curl);
}