Skip to content

Commit 4e010de

Browse files
authored
Merge pull request #24 from dr5hn/update/ApiUsage
Added Unirest to Composer and updated Api Usage
2 parents 2382ad6 + ce93cde commit 4e010de

10 files changed

Lines changed: 97 additions & 9 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.DS_Store
2+
vendor/vendor

vendor/base.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
2-
ini_set('display_errors',1);
3-
ini_set('error_reporting',E_ALL);
2+
ini_set('display_errors', 1);
3+
ini_set('error_reporting', E_ALL);
44

5-
require_once 'unirest-php/src/Unirest.php';
5+
require_once 'vendor/autoload.php';
66

77
header('Content-type: text/plain');
88

99
$NUMBER_OF_SECONDS = 1;
10+
$API_KEY = ''; // Your RapidApi GeoDBCities Api Key
1011

1112
function slugify($text)
1213
{

vendor/composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "Countries States Cities Database",
3+
"description": "Full Database of city state country available in JSON and SQL Format All Countries, States & Cities are Covered and Populated with Different Combinations & Versions.",
4+
"version": "v0.2",
5+
"require": {
6+
"mashape/unirest-php": "^3.0"
7+
}
8+
}

vendor/composer.lock

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/counter.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2981
1+
1

vendor/get_cities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
$response = Unirest\Request::get($url,
1919
array(
2020
"X-RapidAPI-Host" => "wft-geo-db.p.rapidapi.com",
21-
"X-RapidAPI-Key" => ""
21+
"X-RapidAPI-Key" => $API_KEY
2222
)
2323
);
2424

vendor/get_countries.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$response = Unirest\Request::get($url,
1212
array(
1313
"X-RapidAPI-Host" => "wft-geo-db.p.rapidapi.com",
14-
"X-RapidAPI-Key" => ""
14+
"X-RapidAPI-Key" => $API_KEY
1515
)
1616
);
1717
$fp = fopen('data/countries.json', 'a');

vendor/get_states.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
$response = Unirest\Request::get($url,
1616
array(
1717
"X-RapidAPI-Host" => "wft-geo-db.p.rapidapi.com",
18-
"X-RapidAPI-Key" => ""
18+
"X-RapidAPI-Key" => $API_KEY
1919
)
2020
);
2121

vendor/read_me.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
----------------------------------
2+
USAGE INSTRUCTIONS
3+
----------------------------------
4+
Step 1 :
5+
Run `composer install` in this folder.
6+
7+
Step 2 :
8+
Subscribe to https://rapidapi.com/wirefreethought/api/geodb-cities and get the API Key
9+
10+
Step 3 :
11+
Fill in the API Key in base.php
12+
13+
Step 4 :
14+
Now you'll be able to run get_countries.php, get_states.php, get_cities.php..

vendor/test_api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// $response = Unirest\Request::get("http://geodb-free-service.wirefreethought.com/v1/geo/cities?offset=0&limit=10",
66
// array(
77
// "X-RapidAPI-Host" => "geodb-free-service.wirefreethought.com",
8-
// "X-RapidAPI-Key" => ""
8+
// "X-RapidAPI-Key" => $API_KEY
99
// )
1010
// );
1111

@@ -15,7 +15,7 @@
1515
// $response = Unirest\Request::get("http://geodb-free-service.wirefreethought.com/v1/geo/cities/Q1520",
1616
// array(
1717
// "X-RapidAPI-Host" => "geodb-free-service.wirefreethought.com",
18-
// "X-RapidAPI-Key" => ""
18+
// "X-RapidAPI-Key" => $API_KEY
1919
// )
2020
// );
2121

0 commit comments

Comments
 (0)