[shortcode]
$api_key = ‘Gk)j1(jSw024RDR)q5NF56Y85Bm4B6BhfSvpuZ0abXwx(oK9jNeStqBWTl2ApcIac1r22UyaQ2s0d0KeUYVccmG=====2’;
$page_size = 20;
$page = 1;
$attractions = array();
while (true) {
$url = “https://api.tourismthailand.org/tatapi/v5/attractions?api_key=$Gk)j1(jSw024RDR)q5NF56Y85Bm4B6BhfSvpuZ0abXwx(oK9jNeStqBWTl2ApcIac1r22UyaQ2s0d0KeUYVccmG=====2&page=$page&limit=$page_size”;
$response = wp_remote_get($url);
$data = json_decode(wp_remote_retrieve_body($response), true);
if (empty($data[‘data’])) {
break;
}
$attractions = array_merge($attractions, $data[‘data’]);
$page++;
}
foreach ($attractions as $attraction) {
echo ‘
‘;
echo ‘
‘ . $attraction[‘description’] . ‘
‘;
}
[/shortcode]
Welcome to WanderThai, the ultimate guide to unlocking the secrets of Thailand. Our website is your gateway to exploring this vibrant and diverse…
Welcome to WanderThai, the ultimate guide to unlocking the secrets of Thailand. Our website is your gateway to exploring this vibrant and diverse…
Proudly powered by WordPress