Como obter a lista de Estados dos Países via API ?

URL: http://www.nomedoseusite.com.br/api_customers.php?country_id=COUNTRY_ID&action=customers_state

Parameter Format Description
country_id GET

Number of the Country ID
Check the API to get the list of country
Only number is required
Format: int(11)
* FIELD REQUIRED

PHP Sample:

 // sample customers state list

 $add_query_order = '';
 $country_id = '';
 if ($country_id != '') {
 $add_query_order .= '&country_id='.$country_id;
 }
 
 $url = $domain_url . '/api_customers.php?action=customers_state'.$add_query_order;

 $ch = curl_init($url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
 curl_setopt($ch, CURLOPT_HTTPHEADER, array( 
 'Content-Type: application/json',
 "Cache-Control: no-cache", 
 'Usuario1: ' . base64_encode($usuario1),
 'Senha1: ' . base64_encode($senha1)) 
 ); 
 
 $result = curl_exec($ch);
 curl_close($ch);

 print_r($result);

 // sample customers state list eof

Return:

id
text

Deixe um comentário 0