arronjazz
arronjazz6mo ago

How to write a php curl api call (Please HELP) ? I have tried this

My buildship query parameters are : prompt, content_buffer $data = array( 'prompt' => "Who is the us president ?", 'content_buffer' => ' '); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($data) ); curl_setopt($ch, CURLOPT_POST, count($data)); /curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json' ));/ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch); curl_close($ch); This does not work.
Solution:
Hi @arronjazz, Currently only JavaScript and TypeScript are supported. You can use the HTTP curl instead.
Jump to solution
1 Reply
Solution
Gaurav Chadha
Gaurav Chadha6mo ago
Hi @arronjazz, Currently only JavaScript and TypeScript are supported. You can use the HTTP curl instead.