<?php
function getTrackingUrl(): string
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://server.4markets.net/api/v2/offers/tracking-domain");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        "Referer: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
    ]);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($httpCode != 200) {
        return "";
    }
    if (empty($response)) {
        return "";
    }

    $responseTrackingDomainJson = json_decode($response);

    if (empty($responseTrackingDomainJson)) {
        return "";
    }

    return $responseTrackingDomainJson->details->endpoint;
}

$trackingUrl = getTrackingUrl();
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="robots" content="noindex, nofollow"/>
	<meta http-equiv="cache-control" content="max-age=0"/>
	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0"/>
	<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
	<meta http-equiv="pragma" content="no-cache"/>
	<title>Support | Immediate Bitcoin</title>

	<link rel="shortcut icon" type="image/x-icon" href="/favico.png">
	<link rel="apple-touch-icon" href="/favico-xl.png">

	<!-- BEGIN intgrtn -->
	<script>
		window.intgrtnInit = function () {
			var path = "/";
			if (window.location.pathname.split("/")[1]) {
				path = "/" + window.location.pathname.split("/")[1] + "/";
			}
			window.intgrtn.setOptions({
				cookies: {
					path: path
				},
			});
		};
		(function (d) {
			if (window.intgrtn) {
				return;
			}
			var s = d.createElement("script");
			var date = new Date();
            s.src = "<?php echo $trackingUrl?>/api/v2/integration/app.js?v=1" + date.getFullYear().toString() + date.getMonth().toString() + date.getDate().toString() + date.getHours().toString() + Math.round(date.getMinutes() / 10).toString();
			d.getElementsByTagName("head")[0].appendChild(s);
		}(document));
	</script>
	<!-- END intgrtn -->
</head>
<body>
<div data-intgrtn-form-contact-request-message=""></div>
</body>
</html>