-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit.php
32 lines (28 loc) · 864 Bytes
/
submit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$nama = $_POST['nama'];
$nim = $_POST['nim'];
$prodi = $_POST['prodi'];
$ipk = $_POST['ipk'];
$senddata = array(
'nama' => $nama,
'nim' => $nim,
'prodi' => $prodi,
'ipk' => $ipk,
);
$data = json_encode( $senddata , JSON_FORCE_OBJECT );
$context = array(
'http' => array(
'method' => 'POST',
'header' => "Content-Length: " . strlen( $data ) . "\r\nContent-Type: application/json\r\n",
'content' => $data
)
);
print_r($context);
$context = stream_context_create( $context );
$url = "http://localhost/kuliah/rest/putrest.php";
$result = file_get_contents( $url, false, $context );
$response = json_decode($result, true);
var_dump($response);
if($response['status'] == '200')
header('Location: readrest.php');
?>