Discussions

Ask a Question
Back to All

problem in api integration in php

hello, i want to integrate your api in php, when i pass static parameter inside CURLOPT_POSTFIELDS it works great but now problem is we have to pass multiple data using mysqli so i create one code with php all details are stored same as static in variable and when i tried to pass that varialbe inside CURLOPT_POSTFIELDS it is not working i am writing hre my code so please help me we are trying from since last 4 days, when i try to chat the dont have any answer, so please help us..here is the code.

","",$a); echo $a; //$file = fopen("test.txt","w"); //fwrite($file,$a); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.easyship.com/rate/v1/rates"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS,$a); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-Type: application/json", "Authorization:Bearer sand_UnYzduaox5VgXzcBNMR+DROGpG/36KbaCBmmEjlVeUE=" )); $response = curl_exec($ch); curl_close($ch); var_dump($response); ?>