-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
72 lines (56 loc) · 1.76 KB
/
Copy pathindex.php
File metadata and controls
72 lines (56 loc) · 1.76 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
echo "<pre>";
use Firebase\JWT\JWT;
require_once "JWT.php";
$time = time();
$key = "CarRG180818";
$token = array(
"username" => "CarRG",
"password" => "180818",
"iat" => $time, // Tiempo que inicia el token
"exp" => $time + (60 * 60) // Tiempo que expir el token, 1 hora
);
$jwt =JWT::encode($token, $key);
print_r($jwt);
echo "<br /><br />";
$decode_jwt = JWT::decode($jwt, $key, array("HS256"));
print_r($decode_jwt);
/* $curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://localhost:3000/v1/users");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
//"Content-length: 0",
"Content-Type: application/json",
"Authorization: Bearer 123456789"
)
);
//curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
//curl_setopt($curl, CURLOPT_USERPWD, "username:password");
//curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($curl, CURLOPT_PUT, 1);s
//curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
//curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
//curl_setopt($crl, CURLOPT_SSL_VERIFYHOST, false);
//curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POSTFIELDS,
'
{
"name": "Carmelo 3",
"last_name": "Bravo",
"phone": "7774412104"
}
'
);
$result = curl_exec($curl);
if ($result === false)
{
// throw new Exception('Curl error: ' . curl_error($crl));
print_r('Curl error: ' . curl_error($curl));
}
else
{
print_r($result);
}
curl_close($curl); */
echo "</pre>";
?>