<?php
$lpType = '';
$availableLpTypes = array("1stepnopwd", "singlepg");
if (!empty($_GET["intgrtn_lpType"])) {
    if (in_array($_GET["intgrtn_lpType"], $availableLpTypes)) {
        $lpType = $_GET["intgrtn_lpType"];
    }
}
$baseHref = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
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 lang="en">
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<head>
	<meta name="description" content="Crypto Bank">
	<meta charset="UTF-8">
	<title>Crypto Bank</title>
	<base href="<?= $baseHref; ?>">
	<link rel="shortcut icon" type="image/png" href="favicon.png"/>
	<link rel="apple-touch-icon" href="favicon.png"/>
	<meta name="robots" content="noindex, nofollow">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<link rel="stylesheet" href="css/bootstrap.min.css"/>
	<link rel="stylesheet" href="css/video-js.css">
	<link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.css">
    <link rel="stylesheet" href="css/intgrtn.css?v=<?php echo filemtime(__DIR__ . '/../css/intgrtn.css'); ?>">

	<style class="js-intgrtn-i18n-styles">
		[data-i18n] {
			opacity: 0;
		}
	</style>