<?php
$year = date('Y');
$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 <?php if ($lpType === 'v2' || $lpType === 'v3' || $lpType === 'v4' || $lpType === 'v5') : echo "color-version='$lpType'"; endif ?>>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
    <link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon">
    <link href="https://fonts.googleapis.com/css?family=Roboto:100,200,300,400,500,600,700,800,900" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Oswald:100,200,300,400,500,600,700,800,900" rel="stylesheet">
    <meta name="author" content="Traders Expert">
    <meta name="copyright" content="&copy; <?php echo $year; ?> Traders Expert">
    <meta name="keywords" content="trading, community, forex trading, forex experts">
    <title>SmartTrader</title>
    <meta name="title" content="SmartTrader ✔ Traders Expert">
    <meta name="description" content="Smart trading Is Making People Rich">
    <meta name="robots" content="noindex">