jquery - How can I execute this cURL command with AJAX? -


i've searched , down , have tried variety of different ajax implementations try , figure out how go doing this.

i have pretty simple curl command, should login , authenticate api:

curl -c cjar -b cjar -k -h "content-type: application/json" -x post https://bmc/login -d "{\"data\": [ \"username\", \"password\" ] }"

how supposed write in ajax? :[

one issue: failed load resource: net::err_insecure_response

the request stalled... idea on how go writing via ajax extremely helpful.

edit: wanted make note particularly unsure of how handle -c cjar -b cjar , -k

edit: net::err_insecure_response has self-signed certificate issue, @ least i'm pretty sure that's problem. i've added custom "trust" settings localhost certificate, i'm still have issues.

enter image description here

thanks

curl able send , receive data cross domain remote servers not case javascript (for security reasons).

i suggest writing server-side proxy gathers information need displays in way can use ajax page.

a curl example in php:

<?php         // create curl resource         $ch = curl_init();          // set url         curl_setopt($ch, curlopt_url, "example.com");          //return transfer string         curl_setopt($ch, curlopt_returntransfer, 1);          // $output contains output string         $output = curl_exec($ch);          // close curl resource free system resources         curl_close($ch);      ?> 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -