ip code changes
This commit is contained in:
@@ -26,12 +26,25 @@ class OurServicesController extends Controller
|
|||||||
$userIP = $request->ip(); // Get the user's IP address
|
$userIP = $request->ip(); // Get the user's IP address
|
||||||
|
|
||||||
// Make a GET request to ipinfo.io
|
// Make a GET request to ipinfo.io
|
||||||
$response = Http::get("https://ipinfo.io/{$userIP}/json");
|
// $response = Http::get("https://ipinfo.io/{$userIP}/json");
|
||||||
// Parse the JSON response
|
// Parse the JSON response
|
||||||
$data = $response->json();
|
// $data = $response->json();
|
||||||
// $data = json_decode($response->getBody(), true);
|
// $data = json_decode($response->getBody(), true);
|
||||||
// Get user's country code from the API response
|
// Get user's country code from the API response
|
||||||
$userCountry['data'] = $data['country'];
|
// $userCountry['data'] = $data['country'];
|
||||||
|
|
||||||
|
$response = Http::get("http://ip-api.com/json/{$userIP}");
|
||||||
|
|
||||||
|
// Convert the response to an array
|
||||||
|
$data = $response->json();
|
||||||
|
|
||||||
|
// Check if the status in the response is 'success'
|
||||||
|
if ($data['status'] === 'success') {
|
||||||
|
// Process the data as needed
|
||||||
|
$userCountry['data'] = $data['countryCode'];
|
||||||
|
} else {
|
||||||
|
$userCountry['data'] = "";
|
||||||
|
}
|
||||||
|
|
||||||
// dd($userCountry);
|
// dd($userCountry);
|
||||||
|
|
||||||
@@ -49,12 +62,25 @@ class OurServicesController extends Controller
|
|||||||
$userIP = $request->ip(); // Get the user's IP address
|
$userIP = $request->ip(); // Get the user's IP address
|
||||||
|
|
||||||
// Make a GET request to ipinfo.io
|
// Make a GET request to ipinfo.io
|
||||||
$response = Http::get("https://ipinfo.io/{$userIP}/json");
|
// $response = Http::get("https://ipinfo.io/{$userIP}/json");
|
||||||
// Parse the JSON response
|
// Parse the JSON response
|
||||||
$data = $response->json();
|
// $data = $response->json();
|
||||||
// $data = json_decode($response->getBody(), true);
|
// $data = json_decode($response->getBody(), true);
|
||||||
// Get user's country code from the API response
|
// Get user's country code from the API response
|
||||||
$userCountry['data'] = $data['country'];
|
// $userCountry['data'] = $data['country'];
|
||||||
|
|
||||||
|
$response = Http::get("http://ip-api.com/json/{$userIP}");
|
||||||
|
|
||||||
|
// Convert the response to an array
|
||||||
|
$data = $response->json();
|
||||||
|
|
||||||
|
// Check if the status in the response is 'success'
|
||||||
|
if ($data['status'] === 'success') {
|
||||||
|
// Process the data as needed
|
||||||
|
$userCountry['data'] = $data['countryCode'];
|
||||||
|
} else {
|
||||||
|
$userCountry['data'] = "";
|
||||||
|
}
|
||||||
|
|
||||||
// dd($userCountry);
|
// dd($userCountry);
|
||||||
|
|
||||||
@@ -72,12 +98,25 @@ class OurServicesController extends Controller
|
|||||||
$userIP = $request->ip(); // Get the user's IP address
|
$userIP = $request->ip(); // Get the user's IP address
|
||||||
|
|
||||||
// Make a GET request to ipinfo.io
|
// Make a GET request to ipinfo.io
|
||||||
$response = Http::get("https://ipinfo.io/{$userIP}/json");
|
// $response = Http::get("https://ipinfo.io/{$userIP}/json");
|
||||||
// Parse the JSON response
|
// Parse the JSON response
|
||||||
$data = $response->json();
|
// $data = $response->json();
|
||||||
// $data = json_decode($response->getBody(), true);
|
// $data = json_decode($response->getBody(), true);
|
||||||
// Get user's country code from the API response
|
// Get user's country code from the API response
|
||||||
$userCountry['data'] = $data['country'];
|
// $userCountry['data'] = $data['country'];
|
||||||
|
|
||||||
|
$response = Http::get("http://ip-api.com/json/{$userIP}");
|
||||||
|
|
||||||
|
// Convert the response to an array
|
||||||
|
$data = $response->json();
|
||||||
|
|
||||||
|
// Check if the status in the response is 'success'
|
||||||
|
if ($data['status'] === 'success') {
|
||||||
|
// Process the data as needed
|
||||||
|
$userCountry['data'] = $data['countryCode'];
|
||||||
|
} else {
|
||||||
|
$userCountry['data'] = "";
|
||||||
|
}
|
||||||
|
|
||||||
// dd($userCountry);
|
// dd($userCountry);
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,26 @@ class TransformBeyondController extends Controller
|
|||||||
$userIP = $request->ip(); // Get the user's IP address
|
$userIP = $request->ip(); // Get the user's IP address
|
||||||
|
|
||||||
// Make a GET request to ipinfo.io
|
// Make a GET request to ipinfo.io
|
||||||
$response = Http::get("https://ipinfo.io/{$userIP}?token=fb9b51b5a3bbd9");
|
// $response = Http::get("https://ipinfo.io/{$userIP}?token=fb9b51b5a3bbd9");
|
||||||
// Parse the JSON response
|
// Parse the JSON response
|
||||||
$data = $response->json();
|
// $data = $response->json();
|
||||||
// dd($data);
|
// dd($data);
|
||||||
// $data = json_decode($response->getBody(), true);
|
// $data = json_decode($response->getBody(), true);
|
||||||
// Get user's country code from the API response
|
// Get user's country code from the API response
|
||||||
$userCountry['data'] = $data['country'];
|
// $userCountry['data'] = $data['country'];
|
||||||
|
|
||||||
|
$response = Http::get("http://ip-api.com/json/{$userIP}");
|
||||||
|
|
||||||
|
// Convert the response to an array
|
||||||
|
$data = $response->json();
|
||||||
|
|
||||||
|
// Check if the status in the response is 'success'
|
||||||
|
if ($data['status'] === 'success') {
|
||||||
|
// Process the data as needed
|
||||||
|
$userCountry['data'] = $data['countryCode'];
|
||||||
|
} else {
|
||||||
|
$userCountry['data'] = "";
|
||||||
|
}
|
||||||
|
|
||||||
// dd($userCountry);
|
// dd($userCountry);
|
||||||
|
|
||||||
|
|||||||
1925
composer.lock
generated
1925
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user