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"); // Parse the JSON response // $data = $response->json(); // dd($data); // $data = json_decode($response->getBody(), true); // Get user's country code from the API response // $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); } }