JSFiddle - React, Tailwind, and code Playground

by Matt Hopkins

HTML

<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.ipdata.co/" . $_SERVER['REMOTE_ADDR']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Accept: application/json"
));

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
/*
echo($data["ip"]);
echo($data["continent_code"]);
*/
if ($data["continent_code"] == "EU") {
    exit("<html><head><title>GDPR Notice</title></head><body><h1>Due to GDPR, the content of this site is not available in your location. If you have questions, you can email us at <a href='mailto:[email protected]'>contact (at) muscle1.co</a>.</h1></body></html>");
}