Add Data User

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.2 kB
13
Indexable
Never
$form_curl = array(
    'name'        =>  $request->fullname,
    'nik'        =>  $request->nik,
    'email'        =>  $request->email_register,
    'department_id'        =>  $request->roleid,
    'phone'        =>  $request->telpno,
    'kdprov'        =>  $request->kdprov,
    'kdkab'        =>  $request->kdkab,
    'kdkec'        =>  $request->kdkec,
    'kddesa'        =>  $request->kddesa,
    'birth_date'        =>  $request->tgl_lahir,
    'gender'        =>  $request->jenis_kelamin,
    'address'        =>  $request->alamat,
    'password'        =>  $request->password,
);

$postdata = json_encode($form_curl);

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.sistemweb.my.id/save-register',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $postdata,
CURLOPT_HTTPHEADER => array(
    'token: aW50ZWdyYXNpbW9uZXZsYXBraW4yMDI0a2VtZW5kZXNh',
    'Content-Type: application/json',
),
));

$response = curl_exec($curl);
curl_close($curl);
Leave a Comment