-
Notifications
You must be signed in to change notification settings - Fork 0
/
imeicheck.php
73 lines (61 loc) · 1.85 KB
/
imeicheck.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
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
73
<?php
// $response = '{
// "id": 26385,
// "status": "Done",
// "service": "Basic IMEI Check",
// "service_id": 0,
// "created_at": "2024-05-10T11:18:17.606685+02:00",
// "imei": "352130212294507",
// "imei2": null,
// "sn": null,
// "phone_number": null,
// "text": null,
// "token_key": "d00***28c",
// "token_request_price": "0.020",
// "result": {
// "imei": "352130212294507",
// "brand_name": "Motorola",
// "model": "New Model"
// },
// "is_custom_result": false,
// "requested_at": "2024-05-10T11:18:17.606419+02:00",
// "custom_format_response": null
// }';
// $data = json_decode($response, true);
// // Extract the result part
// $result = $data['result'];
// // Encode the result part back to JSON
// $resultJson = json_encode($result);
// // Print the result JSON
// echo $resultJson;
// die();
define('API_KEY','d0005165-eae4-458f-8737-e036192df28c');
$imeiNo = $_POST['imeiNo'];
// Initialize a cURL session
$curl = curl_init();
// Set the options for the cURL request
curl_setopt_array($curl, [
CURLOPT_URL => "https://dash.imei.info/api/check/0/?API_KEY=".API_KEY."&imei=".$imeiNo,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"accept: application/json"
],
]);
// Execute the cURL session and store the response
$response = curl_exec($curl);
header('Content-type: application/json');
// Check for errors in the cURL request
if(curl_errno($curl)) {
} else {
// Print the response if no errors occurred
$data = json_decode($response, true);
// Extract the result part
$result = $data['result'];
// Encode the result part back to JSON
$resultJson = json_encode($result);
// Print the result JSON
echo $resultJson;
}
// Close the cURL session
curl_close($curl);