🌍 Discover our global repository of countries, states, and cities! 🏙️ Get comprehensive data in JSON, SQL, PSQL, XML, YAML, and CSV formats. Access ISO2, ISO3 codes, country code, capital, native language, timezones (for countries), and more. #countries #states #cities
where $apiKey is 'X-CSCAPI-KEY'
and apiValue is my key,
when I get the array response with:
$response = json_decode( curl_exec( $curl ), true);
it gives me null, I was thinking that the problem is the api key I received,
When I copy paste the key from the email at the and of the character sequence there is an additional space,
I thought that maybe its part of the key too?, in both ways, with or without it doesn't work
I've also tried to write the curl_setopt_array like this:
Hello, I wanted to report this fact, I'm doing everything via php, I followed the tutorial for php, I report the code:
$curl = curl_init();
curl_setopt_array( $curl, array( CURLOPT_URL => 'https://api.countrystatecity.in/v1/countries', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( $this::$apiKey . ': ' . $this::$apiValue, ), ));
where $apiKey is 'X-CSCAPI-KEY' and apiValue is my key,
when I get the array response with: $response = json_decode( curl_exec( $curl ), true);
it gives me null, I was thinking that the problem is the api key I received,
When I copy paste the key from the email at the and of the character sequence there is an additional space, I thought that maybe its part of the key too?, in both ways, with or without it doesn't work
I've also tried to write the curl_setopt_array like this:
curl_setopt_array( $curl, array( CURLOPT_URL => 'https://api.countrystatecity.in/v1/countries', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'X-CSCAPI-KEY: my_key', ), ));
neither this way it returns me any data...
what can I do?