wanderthai.com

Attractions - wanderthai.com

[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 ‘

‘ . $attraction[‘name’] . ‘

‘;
echo ‘

‘ . $attraction[‘description’] . ‘

‘;
}
[/shortcode]

Sawasdee

Sawasdee

Mar 22, 2023

Welcome to WanderThai, the ultimate guide to unlocking the secrets of Thailand. Our website is your gateway to exploring this vibrant and diverse…

Sawasdee

Sawasdee

Mar 21, 2023

Welcome to WanderThai, the ultimate guide to unlocking the secrets of Thailand. Our website is your gateway to exploring this vibrant and diverse…

wanderthai.com

Proudly powered by WordPress