ip code changes

This commit is contained in:
Adarsh Pandey
2024-08-29 13:26:35 +05:30
parent ebcd00954f
commit 1f38cd598c
3 changed files with 1044 additions and 997 deletions

View File

@@ -11,76 +11,115 @@ use Illuminate\Support\Facades\Http;
class OurServicesController extends Controller
{
public function index(){
return view('website.pages.our_services');
}
//transform and beyond biginners
public function transform_beyond_beginner(Request $request){
// $apiKey = "bdf20639fab33d6dc265da0f6926a491";
// $ip = $request->ip(); // Get user's IP address
// $client = new Client();
// $response = $client->get("http://api.ipstack.com/{$ip}?access_key={$apiKey}");
$userIP = $request->ip(); // Get the user's IP address
// 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
$data = $response->json();
// $data = $response->json();
// $data = json_decode($response->getBody(), true);
// 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);
return view('website.pages.transform_beyond_beginner',$userCountry);
}
//gsf exclusive
public function gsf_exclusive(Request $request){
// $apiKey = "bdf20639fab33d6dc265da0f6926a491";
// $ip = $request->ip(); // Get user's IP address
// $client = new Client();
// $response = $client->get("http://api.ipstack.com/{$ip}?access_key={$apiKey}");
$userIP = $request->ip(); // Get the user's IP address
// 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
$data = $response->json();
// $data = $response->json();
// $data = json_decode($response->getBody(), true);
// 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);
return view('website.pages.gsf_exclusive',$userCountry);
}
// get set eat
public function get_set_eat(Request $request){
// $apiKey = "bdf20639fab33d6dc265da0f6926a491";
// $ip = $request->ip(); // Get user's IP address
// $client = new Client();
// $response = $client->get("http://api.ipstack.com/{$ip}?access_key={$apiKey}");
$userIP = $request->ip(); // Get the user's IP address
// 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
$data = $response->json();
// $data = $response->json();
// $data = json_decode($response->getBody(), true);
// 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);
return view('website.pages.get_set_eat',$userCountry);
}
}

View File

@@ -10,24 +10,37 @@ use Illuminate\Support\Facades\Http;
class TransformBeyondController extends Controller
{
public function index(Request $request){
// $apiKey = "bdf20639fab33d6dc265da0f6926a491";
// $ip = $request->ip(); // Get user's IP address
// $client = new Client();
// $response = $client->get("http://api.ipstack.com/{$ip}?access_key={$apiKey}");
$userIP = $request->ip(); // Get the user's IP address
// 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
$data = $response->json();
// $data = $response->json();
// dd($data);
// $data = json_decode($response->getBody(), true);
// 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);
return view('website.pages.transform_beyond',$userCountry);

1925
composer.lock generated

File diff suppressed because it is too large Load Diff