-
Notifications
You must be signed in to change notification settings - Fork 8
/
ext_geoip.php
221 lines (202 loc) · 7.3 KB
/
ext_geoip.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?hh
/**
* geoip_asnum_by_name() - Returns the Autonomous System Number found in the GeoIP Database.
*
* @param string $hostname
*
* @return mixed Returns the ASN on success.
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_asnum_by_name(string $hostname): mixed;
/**
* geoip_continent_code_by_name() - Get the two letter continent code
*
* @param string $hostname
*
* @return mixed Returns the two letter continent code on success.
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_continent_code_by_name(string $hostname): mixed;
/**
* geoip_country_code_by_name() - Get the two letter country code
*
* @param string $hostname
*
* @return mixed Returns the two letter ISO country code on success.
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_country_code_by_name(string $hostname): mixed;
/**
* geoip_country_code3_by_name() - Get the three letter country code
*
* @param string $hostname
*
* @return mixed Returns the three letter country code on success.
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_country_code3_by_name(string $hostname): mixed;
/**
* geoip_country_name_by_name() - Get the full country name
*
* @param string $hostname
*
* @return mixed Returns the country name on success.
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_country_name_by_name(string $hostname): mixed;
/**
* geoip_database_info() - Get GeoIP Database information
*
* @param int $database Database type
*
* @return mixed Returns the database version on success.
* Returns NULL on error.
*/
<<__Native>> function geoip_database_info(int $database = GEOIP_COUNTRY_EDITION): mixed;
/**
* geoip_db_avail() - Determine if GeoIP Database is available
*
* @param int $database Database type
*
* @return mixed Returns TRUE if the database is available.
* Returns FALSE if the database is not available.
* Returns NULL on error.
*/
<<__Native>> function geoip_db_avail(int $database): mixed;
/**
* geoip_db_filename() - Returns the filename of the corresponding GeoIP Database
*
* @param int $database Database type
*
* @return mixed Returns the database filename on success.
* Returns NULL on error.
*/
<<__Native>> function geoip_db_filename(int $database): mixed;
/**
* geoip_db_get_all_info() - Returns detailed information about all GeoIP database types
*
* @return array Returns an array of associative arrays, each with the keys:
* "available" - boolean
* "description" - database description
* "filename" - database filename
*/
<<__Native>> function geoip_db_get_all_info(): array;
/**
* geoip_domain_by_name() - Returns the Domain Name found in the GeoIP Database
*
* @param string $hostname
*
* @return mixed Returns the domain name on success.
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_domain_by_name(string $hostname): mixed;
/**
* geoip_id_by_name() - Get the Internet connection type
*
* @param string $hostname
*
* @return mixed Returns one of GEOIP_UNKNOWN_SPEED, GEOIP_DIALUP_SPEED,
* GEOIP_CABLEDSL_SPEED, or GEOIP_CORPORATE_SPEED on success.
* Returns NULL on error.
*/
<<__Native>> function geoip_id_by_name(string $hostname): mixed;
/**
* geoip_isp_by_name() - Get the Internet Service Provider (ISP) name
*
* @param string $hostname
*
* @return mixed Returns the ISP name on success.
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_isp_by_name(string $hostname): mixed;
/**
* geoip_netspeedcell_by_name() - Get the estimated connection speed
*
* @param string $hostname
*
* @return mixed Returns the connection speed as a string on success, i.e.,
* one of: "Cable/DSL", "Cellular", "Corporate", or "Dialup".
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_netspeedcell_by_name(string $hostname): mixed;
/**
* geoip_org_by_name() - Get the organization name
*
* @param string $hostname
*
* @return mixed Returns the organization name on success.
* Returns FALSE if the address cannot be found in the database.
* Returns NULL on error.
*/
<<__Native>> function geoip_org_by_name(string $hostname): mixed;
/**
* geoip_record_by_name() - Returns the detailed City information found in the GeoIP City Database
*
* @param string $hostname
*
* @return mixed Returns an associative array with the keys:
* "continent_code" - two letter continent code
* "country_code" - two letter ISO country code
* "country_code3" - three letter country code
* "country_name" - country name
* "region" - region code
* "city" - city
* "postal_code" - postal code, FSA, or zip code
* "latitude" - latitude
* "longitude" - longitude
* "dma_code" - Designated Market Area
* "area_code" - PSTN area code
* Returns FALSE if host not found.
* Returns NULL on error.
*/
<<__Native>> function geoip_record_by_name(string $hostname): mixed;
/**
* geoip_region_by_name() - Get the country code and region
*
* @param string $hostname
*
* @return mixed Returns an associative array with the keys:
* "country_code" - two letter ISO country code
* "region" - region code.
* Returns FALSE if host not found.
* Returns NULL on error.
*/
<<__Native>> function geoip_region_by_name(string $hostname): mixed;
/**
* geoip_region_name_by_code() - Returns the region name for some country and region code combo
*
* @param string $country_code
* @param string $region_code
*
* @return mixed Returns the region name on success.
* Returns FALSE if country and region code combo not found.
* Returns NULL on error.
*/
<<__Native>> function geoip_region_name_by_code(string $country_code, string $region_code): mixed;
/**
* geoip_setup_custom_directory() - Sets the custom directory for GeoIP databases
*
* @param string $directory
*
* @return void
*/
<<__Native>> function geoip_setup_custom_directory(string $directory): mixed;
/**
* geoip_time_zone_by_country_and_region() - Returns the time zone for some country and region code combo
*
* @param string $country_code
* @param string $region_code
*
* @return mixed Returns the timezone on success.
* Returns FALSE if country and region code combo not found.
* Returns NULL on error.
*/
<<__Native>> function geoip_time_zone_by_country_and_region(string $country_code, ?string $region_code = NULL): mixed;