Server IP : 198.54.125.146 / Your IP : 3.135.201.22 [ Web Server : LiteSpeed System : Linux business38.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64 User : engixevu ( 716) PHP Version : 8.1.31 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/engixevu/ilivetracker.com/ |
Upload File : |
<?php // Example usage require_once './config.php'; header('Content-Type: application/json'); // Define the mobile function function mobile($response) { // Process the response for mobile type echo "Mobile response: " . $response; } // Define the vehicle function function vehicle($response) { // Process the response for vehicle type echo "Vehicle response: " . $response; } // Define the ptcl function function ptcl($response) { // Process the response for ptcl type echo "PTCL response: " . $response; } if (isset($_GET['search']) && isset($_GET['type'])) { $url = $apiEndpoint; $searchFilter = $_GET['search']; $searchFilter = ltrim($searchFilter, '0'); $searchFilter = ltrim($searchFilter, '+92'); $data = array( 'search' => $searchFilter, 'type' => $_GET['type'], ); // Encode data as JSON $jsonData = json_encode($data); // Initialize cURL $ch = curl_init($url); // Set cURL options curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Authorization: Bearer YOUR_TOKEN_HERE', // Replace with your actual token )); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); // Execute the request $response = curl_exec($ch); // Check for errors if (curl_errno($ch)) { echo 'Error fetching data: ' . curl_error($ch); } else { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode == 200) { if (isset($data['type'])) { if ($data['type'] === 'mobile') { mobile($response); exit(); } elseif ($data['type'] === 'vehicle') { vehicle($response); exit(); } elseif ($data['type'] === 'ptcl') { ptcl($response); exit(); } } echo $response; } else { echo 'Error fetching data: HTTP ' . $httpCode; } } // Close cURL session curl_close($ch); } ?>