Speed up development with full-stack environments for every branch.

Learn More

How to get country list in JSON format [PHP]

Forked from Hello World.

212 Runs 913 Views 35 Copies
Saved

Saved

gtsolutions 373

gtsolutions
published 4 years ago

<?php

/*
 * PHP Country-list - How to get country list in JSON format
 */

//source can be either clrd or icu
$source = "cldr";
$language = "en";
$format = "json";

//get the list
$list = file_get_contents("country/".$source."/".$language."/country.".$format);
//display the list
echo $list;
?>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).