Browser and Node.js integration
fetch('https://api.ip2fy.com/8.8.8.8')
.then(res => res.json())
.then(data => console.log(data))
Django, Flask, and standalone
import requests
response = requests.get('https://api.ip2fy.com/8.8.8.8')
data = response.json()
Laravel, WordPress, and vanilla PHP
$response = file_get_contents('https://api.ip2fy.com/8.8.8.8');
$data = json_decode($response, true);
Spring Boot and Java applications
URL url = new URL("https://api.ip2fy.com/8.8.8.8");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
Hooks and component integration
const [ipData, setIpData] = useState(null);
useEffect(() => {
fetch('https://api.ip2fy.com/')
.then(res => res.json())
.then(setIpData);
}, []);
Composition API and Pinia store
const ipData = ref(null);
onMounted(async () => {
const response = await fetch('https://api.ip2fy.com/');
ipData.value = await response.json();
});
Services and HTTP client
@Injectable({ providedIn: 'root' })
export class IpService {
getLocation() {
return this.http.get('https://api.ip2fy.com/');
}
}
Server-side rendering and API routes
export async function getServerSideProps() {
const res = await fetch('https://api.ip2fy.com/');
const data = await res.json();
return { props: { data } };
}
Plugin development and themes
$response = wp_remote_get('https://api.ip2fy.com/');
if (is_wp_error($response)) return;
$data = json_decode(wp_remote_retrieve_body($response), true);
Theme and app development
fetch('https://api.ip2fy.com/')
.then(res => res.json())
.then(data => {
// Use location data for shipping, taxes, etc.
});
Extension and module development
$client = new \GuzzleHttp\Client();
$response = $client->get('https://api.ip2fy.com/');
$data = json_decode($response->getBody(), true);
E-commerce geolocation features
$response = wp_remote_get('https://api.ip2fy.com/' . $ip_address);
$data = json_decode(wp_remote_retrieve_body($response), true);
Serverless function integration
const axios = require('axios');
exports.handler = async (event) => {
const response = await axios.get('https://api.ip2fy.com/');
return { statusCode: 200, body: JSON.stringify(response.data) };
};
Edge functions and deployments
export default async function handler(req, res) {
const response = await fetch('https://api.ip2fy.com/');
const data = await response.json();
res.status(200).json(data);
}
Edge functions and forms
exports.handler = async (event, context) => {
const response = await fetch('https://api.ip2fy.com/');
const data = await response.json();
return {
statusCode: 200,
body: JSON.stringify(data)
};
};
Cloud functions and Firestore
const functions = require('firebase-functions');
const fetch = require('node-fetch');
exports.getLocation = functions.https.onRequest(async (req, res) => {
const response = await fetch('https://api.ip2fy.com/');
const data = await response.json();
res.json(data);
});
HTTP client for browser and Node.js
const response = await axios.get('https://api.ip2fy.com/8.8.8.8');
console.log(response.data);
AJAX requests and DOM manipulation
$.get('https://api.ip2fy.com/', function(data) {
console.log(data);
});
Command line and system integration
curl -X GET "https://api.ip2fy.com/8.8.8.8" \
-H "accept: application/json"
API testing and documentation
GET https://api.ip2fy.com/8.8.8.8
Content-Type: application/json
Our documentation and support team are here to help you integrate IP2FY into your project.