forum-msg-id-131005-edit

Original date:2017-04-23 03:37:04 Edited by: jmduro Subject: Re: Euphoria CGI

I have been able to communicate with chromedriver via libcurl and following code (needs Eu3 Standard Library or Eu4 Standard Library or my libcurl wrapper):

include std/filesys.e 
include std/error.e 
include lib/_curl_constants_.e 
include lib/_curl_.e 
include std/console.e 
 
object res 
atom curl 
 
crash_file(InitialDir & SLASH & "ex.err") 
res = curl_global_init(CURL_GLOBAL_DEFAULT) 
curl = curl_easy_init() 
if curl then 
    curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP) 
    curl_easy_setopt(curl, CURLOPT_PROXY, "") 
    curl_easy_setopt(curl, CURLOPT_COOKIEFILE, InitialDir & SLASH & "cookies.txt") 
    curl_easy_setopt(curl, CURLOPT_COOKIEJAR, InitialDir & SLASH & "cookies.txt") 
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1) 
    curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:9515/status") 
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) 
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, "Connection: keep-alive") 
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, "Accept: application/json") 
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, "Content-Type: application/json; charset=UTF-8") 
 
    res = curl_easy_perform_ex(curl) 
 
    printf(1, "Status: %d\n", {res[1]}) 
    printf(1, "Effective URL: %s\n", {res[2]}) 
    analyze_object(res[3], "Headers", 1) 
    analyze_object(res[4], "Content", 1) 
 
  curl_easy_cleanup(curl) 
end if 
 
curl_global_cleanup() 
 
maybe_any_key() 

Jean-Marc

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu