-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjwt.php
More file actions
34 lines (29 loc) · 890 Bytes
/
Copy pathjwt.php
File metadata and controls
34 lines (29 loc) · 890 Bytes
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
<?php
function getJubelioToken() {
$url = "https://api2.jubelio.com/login";
$credentials = [
"email" => "vickyv40@gmail.com",
"password" => "@Cuan5758"
];
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($credentials),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$json = json_decode($response, true);
if ($httpCode === 200 && isset($json["token"])) {
return $json["token"];
}
echo "❌ Gagal login. HTTP: $httpCode\n";
echo "RESPONSE:\n$response\n";
return null;
}