<?php

// STEP 1 - fetch the featured merchants JSON
$featured_merchants_url = 'https://www.wildlink.me/data/3/featured-merchant/1';

$context = stream_context_create([ "http" => [ "header"  => "User-agent: Myagent" ]]); // we need to declare a user agent to comply with Wildfire policy

$data = file_get_contents($featured_merchants_url, false, $context);
$featured_merchants = json_decode($data);

// now we can print a list of merchant IDs to the page
?>

<style>
#merchants {width:500px}

.merchant {border: 1px solid #999; padding: 5px; float: left; margin-right: 10px; margin-bottom: 10px}
</style>

<h1>Merchants</h1>
<div id="merchants">
<?php foreach ($featured_merchants[0]->MerchantIDs as $merchant_id){ ?>
    <div class="merchant"><?=$merchant_id?></div>
<?php } ?>
</div>
