Re: curl
- Posted by petelomax Jun 20, 2019
- 1434 views
enjoy:
include builtins\libcurl.e curl_global_init() atom curl = curl_easy_init() curl_easy_setopt(curl, CURLOPT_URL, "https://data.crossref.org/10.1038/nrd842") atom slist = curl_slist_append(NULL, "Accept: application/x-bibtex") slist = curl_slist_append(slist, "style=bibtex") curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist) object res = curl_easy_perform_ex(curl) if string(res) then ?res else ?"some error" end if curl_slist_free_all(slist) curl_easy_cleanup(curl) curl_global_cleanup()
Originally I did go to "http://dx.doi.org/10.1038/nrd842" but that just gave me the following response which it seems you might as well just cut out
"<html><head><title>Handle Redirect</title></head>\n<body><a href=\"https://data.crossref.org/10.1038%2Fnrd842\">https://data.crossref.org/10.1038%2Fnrd842</a></body></html>"