Sample POST Curl POST API
$orderLines = array("data"=>array(
"active"=>"true",
"client"=>"D089DFFA729F4A22816BD8838AB0813C",
"documentNo"=>(String)$namaKoli,
"movementDate"=>date('Y-m-d'),
"name"=>'Sync By Fadly',
"oezDocaction"=>"AP",
"oezDocstatus"=>"DR",
"oezIsTranferRequest"=>true,
"oezParentMMovement"=>$idHeader,
"oezDrivername"=>$picker,
"posted"=>"N",
"organization"=>"73556C89EE624EA2A7F8046BBB213B0B"
));
$orderLinesJson = json_encode($orderLines);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://idol.infinite-erp.co.id/infinite/org.openbravo.service.json.jsonrest/MaterialMgmtInternalMovement",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 1000,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $orderLinesJson,
CURLOPT_HTTPHEADER => array(
'Content-Type:application/json',
'Authorization: Basic '. 'YWRtaW4tZmFkbHk6YXNhc2Fz',
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
$header = json_decode($response);
}
Belum ada Komentar untuk "Sample POST Curl POST API"
Posting Komentar