SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | // The areacodes really should be in a database or something. Cached at the very least. | |
| 3 | $areacodes = <<<COUNTRYCODE | |
| 4 | 93 Afghanistan | |
| 5 | 355 Albania | |
| 6 | 213 Algeria | |
| 7 | 1684 American Samoa | |
| 8 | 376 Andorra | |
| 9 | 244 Angola | |
| 10 | 1264 Anguilla | |
| 11 | 672 Antarctica | |
| 12 | 1268 Antigua | |
| 13 | 54 Argentina | |
| 14 | 374 Armenia | |
| 15 | 297 Aruba | |
| 16 | 247 Ascension | |
| 17 | 612 Australia - Central East Region | |
| 18 | 613 Australia - South East Region | |
| 19 | 614 Australia - Digital GSM Mobile phones | |
| 20 | 617 Australia - North East Region | |
| 21 | 618 Australia - Central & West Region | |
| 22 | 67210 Australian External Territories - Davis | |
| 23 | 67211 Australian External Territories - Mawson | |
| 24 | 67212 Australian External Territories - Casey | |
| 25 | 67213 Australian External Territories - Macquarie Island | |
| 26 | 43 Austria | |
| 27 | 994 Azerbaijan | |
| 28 | 1242 Bahamas | |
| 29 | 973 Bahrain | |
| 30 | 880 Bangladesh | |
| 31 | 1246 Barbados | |
| 32 | 1268 Barbuda | |
| 33 | 375 Belarus | |
| 34 | 32 Belgium | |
| 35 | 501 Belize | |
| 36 | 229 Benin | |
| 37 | 1441 Bermuda | |
| 38 | 975 Bhutan | |
| 39 | 591 Bolivia | |
| 40 | 387 Bosnia & Herzegovina | |
| 41 | 267 Botswana | |
| 42 | 55 Brazil | |
| 43 | 1284 British Virgin Islands | |
| 44 | 673 Brunei Darussalam | |
| 45 | 359 Bulgaria | |
| 46 | 226 Burkina Faso | |
| 47 | 257 Burundi | |
| 48 | 855 Cambodia | |
| 49 | 237 Cameroon | |
| 50 | 1780 Canada - Alberta (Northern) | |
| 51 | 1403 Canada - Alberta (Southern) | |
| 52 | 1250 Canada - British Columbia (Except Vancouver) | |
| 53 | 1604 Canada - British Columbia (Vancouver area) | |
| 54 | 1807 Canada - Fort William | |
| 55 | 1519 Canada - London | |
| 56 | 1204 Canada - Manitoba | |
| 57 | 1506 Canada - New Brunswick | |
| 58 | 1709 Canada - Newfoundland | |
| 59 | 1867 Canada - Northwest Territories | |
| 60 | 1867 Canada - Nunavut | |
| 61 | 1902 Canada - Nova Scotia | |
| 62 | 1519 Canada - Ontario (London) | |
| 63 | 1705 Canada - Ontario (North Bay) | |
| 64 | 1613 Canada - Ontario (Ottawa) | |
| 65 | 1807 Canada - Ontario (Thunder Bay) | |
| 66 | 1416 Canada - Ontario (Toronto Metro) See note above | |
| 67 | 1905 Canada - Ontario (Toronto Vicinity) See note above | |
| 68 | 1902 Canada - Prince Edward Island | |
| 69 | 1514 Canada - Québec (Montréal Island) | |
| 70 | 1450 Canada - Québec (Montréal north & south shore) | |
| 71 | 1418 Canada - Québec (Québec City) | |
| 72 | 1819 Canada - Québec (Sherbrooke) | |
| 73 | 1306 Canada - Saskatchewan | |
| 74 | 1867 Canada - Yukon Territory | |
| 75 | 238 Cape Verde Islands | |
| 76 | 1345 Cayman Islands | |
| 77 | 236 Central African Republic | |
| 78 | 235 Chad | |
| 79 | 64 Chatham Island (New Zealand) | |
| 80 | 5655 Chile - Antofagasta | |
| 81 | 5658 Chile - Arica | |
| 82 | 5655 Chile - Calama | |
| 83 | 5642 Chile - Chillán | |
| 84 | 5641 Chile - Concepción | |
| 85 | 5652 Chile - Copiacó | |
| 86 | 5651 Chile - Coquimbo | |
| 87 | 5667 Chile - Coyhaique | |
| 88 | 5675 Chile - Curicó | |
| 89 | 5657 Chile - Iquique | |
| 90 | 5651 Chile - La Serena | |
| 91 | 5673 Chile - Linares | |
| 92 | 5634 Chile - Los Andes | |
| 93 | 5643 Chile - Los Angeles | |
| 94 | 5664 Chile - Osorno | |
| 95 | 5653 Chile - Ovalle | |
| 96 | 5665 Chile - Puerto Montt | |
| 97 | 5661 Chile - Punta Arenas | |
| 98 | 5633 Chile - Quillota | |
| 99 | 5672 Chile - Rancagua | |
| 100 | 5635 Chile - San Antonio | |
| 101 | 5634 Chile - San Felipe | |
| 102 | 5672 Chile - San Fernando | |
| 103 | 562 Chile - Santiago (Metropolitan Region) | |
| 104 | 5641 Chile - Talcahuano | |
| 105 | 5671 Chile - Talca | |
| 106 | 5645 Chile - Temuco | |
| 107 | 5663 Chile - Valdivia | |
| 108 | 5632 Chile - Valparaíso | |
| 109 | 5632 Chile - Viña del Mar | |
| 110 | 86 China (PRC) | |
| 111 | 618 Christmas Island | |
| 112 | 6189162 CocosKeeling Islands | |
| 113 | 57 Colombia | |
| 114 | 269719 Comoros - Domoni | |
| 115 | 269710 Comoros - Mutsamudu | |
| 116 | 269716 Comoros - Mutsamudu | |
| 117 | 269718 Comoros - Sima | |
| 118 | 269720 Comoros - Fomboni | |
| 119 | 269725 Comoros - Fomboni | |
| 120 | 269726 Comoros - Nioumachoua | |
| 121 | 269728 Comoros - Wanani | |
| 122 | 26979 Comoros - Foumbouni and South of Island | |
| 123 | 26977 Comoros - Mbéni and East of Island | |
| 124 | 26978 Comoros - Mitsamiouli and North of Island | |
| 125 | 26973 Comoros - Moroni and Centre of Island | |
| 126 | 26974 Comoros - Moroni and Centre of Island | |
| 127 | 26976 Comoros - Internet and special numbers | |
| 128 | 2693 Comoros - HURI Mobile (GSM 900) | |
| 129 | 242 Congo | |
| 130 | 243 Congo, Dem. Rep. of (former Zaire) | |
| 131 | 682 Cook Islands | |
| 132 | 506 Costa Rica | |
| 133 | 225 Côte d'Ivoire (Ivory Coast) | |
| 134 | 385 Croatia | |
| 135 | 53 Cuba | |
| 136 | 5399 Cuba (Guantanamo Bay) | |
| 137 | 599 Curaçao | |
| 138 | 357 Cyprus | |
| 139 | 420 Czech Republic | |
| 140 | 45 Denmark | |
| 141 | 246 Diego Garcia | |
| 142 | 253 Djibouti | |
| 143 | 1767 Dominica | |
| 144 | 1829 Dominican Republic | |
| 145 | 1809 Dominican Republic | |
| 146 | 670 East Timor | |
| 147 | 56 Easter Island | |
| 148 | 593 Ecuador | |
| 149 | 20 Egypt | |
| 150 | 503 El Salvador | |
| 151 | 8812 Ellipso (Mobile Satellite service) | |
| 152 | 8813 Ellipso (Mobile Satellite service) | |
| 153 | 88213 EMSAT (Mobile Satellite service) | |
| 154 | 240 Equatorial Guinea | |
| 155 | 291 Eritrea | |
| 156 | 372 Estonia | |
| 157 | 251 Ethiopia | |
| 158 | 500 Falkland Islands (Malvinas) | |
| 159 | 298 Faroe Islands | |
| 160 | 679 Fiji Islands | |
| 161 | 358 Finland | |
| 162 | 33 France | |
| 163 | 596 French Antilles | |
| 164 | 594 French Guiana | |
| 165 | 689 French Polynesia | |
| 166 | 241 Gabonese Republic | |
| 167 | 220 Gambia | |
| 168 | 995 Georgia | |
| 169 | 49 Germany | |
| 170 | 233 Ghana | |
| 171 | 350 Gibraltar | |
| 172 | 881 Global Mobile Satellite System (GMSS) | |
| 173 | 8818 Globalstar (Mobile Satellite Service) | |
| 174 | 8819 Globalstar (Mobile Satellite Service) | |
| 175 | 30 Greece | |
| 176 | 299 Greenland | |
| 177 | 1473 Grenada | |
| 178 | 590 Guadeloupe | |
| 179 | 1671 Guam | |
| 180 | 5399 Guantanamo Bay | |
| 181 | 502 Guatemala | |
| 182 | 245 GuineaBissau | |
| 183 | 224 Guinea | |
| 184 | 592 Guyana | |
| 185 | 509 Haiti | |
| 186 | 504 Honduras | |
| 187 | 852 Hong Kong | |
| 188 | 36 Hungary | |
| 189 | 8810 ICO Global (Mobile Satellite Service) | |
| 190 | 8811 ICO Global (Mobile Satellite Service) | |
| 191 | 354 Iceland | |
| 192 | 91 India | |
| 193 | 62 Indonesia | |
| 194 | 871 Inmarsat (Atlantic Ocean East) | |
| 195 | 874 Inmarsat (Atlantic Ocean West) | |
| 196 | 873 Inmarsat (Indian Ocean) | |
| 197 | 872 Inmarsat (Pacific Ocean) | |
| 198 | 870 Inmarsat SNAC | |
| 199 | 800 International Freephone Service | |
| 200 | 808 International Shared Cost Service (ISCS) | |
| 201 | 98 Iran | |
| 202 | 964 Iraq | |
| 203 | 353 Ireland | |
| 204 | 8816 Iridium (Mobile Satellite service) | |
| 205 | 8817 Iridium (Mobile Satellite service) | |
| 206 | 972 Israel | |
| 207 | 39071 Italy - Ancona | |
| 208 | 39080 Italy - Bari | |
| 209 | 39035 Italy - Bergamo | |
| 210 | 39051 Italy - Bologna | |
| 211 | 39030 Italy - Brescia | |
| 212 | 390831 Italy - Brindisi | |
| 213 | 39070 Italy - Cagliari | |
| 214 | 39081 Italy - Capri | |
| 215 | 39095 Italy - Catania | |
| 216 | 39031 Italy - Como | |
| 217 | 39055 Italy - Florence (Firenze) | |
| 218 | 39010 Italy - Genoa | |
| 219 | 390465 Italy - Madonna de Campiglio | |
| 220 | 390884 Italy - Manfredonia | |
| 221 | 39090 Italy - Messina | |
| 222 | 3902 Italy - Milan | |
| 223 | 39039 Italy - Monza | |
| 224 | 39081 Italy - Naples | |
| 225 | 39049 Italy - Padova | |
| 226 | 39091 Italy - Palermo | |
| 227 | 39050 Italy - Pisa | |
| 228 | 390522 Italy - Reggio Emilia | |
| 229 | 390541 Italy - Rimini | |
| 230 | 3906 Italy - Rome | |
| 231 | 39019 Italy - Savona | |
| 232 | 39011 Italy - Torino | |
| 233 | 39040 Italy - Trieste | |
| 234 | 39041 Italy - Venice | |
| 235 | 39045 Italy - Verona | |
| 236 | 390444 Italy - Vicenza | |
| 237 | 3906 Italy - Vatican City | |
| 238 | 1876 Jamaica | |
| 239 | 81 Japan | |
| 240 | 962 Jordan | |
| 241 | 7317 Kazakhstan - Akmola | |
| 242 | 7329 Kazakhstan - Aktau | |
| 243 | 7313 Kazakhstan - Aktubinsk | |
| 244 | 7327 Kazakhstan - Almaty | |
| 245 | 7330 Kazakhstan - Arkalyk | |
| 246 | 7312 Kazakhstan - Atyrau | |
| 247 | 7321 Kazakhstan - Karaganda | |
| 248 | 7314 Kazakhstan - Kostanai | |
| 249 | 7324 Kazakhstan - Kzyl-Orda | |
| 250 | 7336 Kazakhstan - Leninsk | |
| 251 | 7318 Kazakhstan - Pavlodar | |
| 252 | 7315 Kazakhstan - Petropavlovsk | |
| 253 | 7322 Kazakhstan - Semipalatinsk | |
| 254 | 7325 Kazakhstan - Shymkent | |
| 255 | 7328 Kazakhstan - Taldykorgan | |
| 256 | 7311 Kazakhstan - Uralsk | |
| 257 | 7323 Kazakhstan - Ust-Kamenogorsk | |
| 258 | 7326 Kazakhstan - Zhambyl | |
| 259 | 7310 Kazakhstan - Zhezkazgan | |
| 260 | 254 Kenya | |
| 261 | 686 Kiribati | |
| 262 | 850 Korea (North) | |
| 263 | 82 Korea (South) | |
| 264 | 965 Kuwait | |
| 265 | 996 Kyrgyz Republic | |
| 266 | 856 Laos | |
| 267 | 371 Latvia | |
| 268 | 961 Lebanon | |
| 269 | 266 Lesotho | |
| 270 | 231 Liberia | |
| 271 | 218 Libya | |
| 272 | 423 Liechtenstein | |
| 273 | 370 Lithuania | |
| 274 | 352 Luxembourg | |
| 275 | 853 Macao | |
| 276 | 389 Macedonia (Former Yugoslav Rep of.) | |
| 277 | 261 Madagascar | |
| 278 | 265 Malawi | |
| 279 | 60 Malaysia | |
| 280 | 960 Maldives | |
| 281 | 223 Mali Republic | |
| 282 | - | 256 Uganda |
| 282 | + | 256 Uganda |
| 283 | 356 Malta | |
| 284 | 692 Marshall Islands | |
| 285 | 596 Martinique | |
| 286 | 222 Mauritania | |
| 287 | 230 Mauritius | |
| 288 | 269 Mayotte Island | |
| 289 | 52 Mexico | |
| 290 | 691 Micronesia, (Federal States of) | |
| 291 | 1808 Midway Island | |
| 292 | 373 Moldova | |
| 293 | 377 Monaco | |
| 294 | 976 Mongolia | |
| 295 | 382 Montenegro | |
| 296 | 1664 Montserrat | |
| 297 | 212 Morocco | |
| 298 | 258 Mozambique | |
| 299 | 95 Myanmar | |
| 300 | 264 Namibia | |
| 301 | 674 Nauru | |
| 302 | 977 Nepal | |
| 303 | 31 Netherlands | |
| 304 | 5997 Netherlands Antilles - Bonaire | |
| 305 | 599717 Netherlands Antilles - Bonaire | |
| 306 | 59978 Netherlands Antilles - Telbo Cellular | |
| 307 | 59979 Netherlands Antilles - Cellular One | |
| 308 | 5999 Netherlands Antilles - Curacao | |
| 309 | 5996 Netherlands Antilles - Curacao (Mobile Numbers) | |
| 310 | 599416 Netherlands Antilles - Saba | |
| 311 | 5994165 Netherlands Antilles - Saba (Windward Island Cellular) | |
| 312 | 599318 Netherlands Antilles - St. Eutatius | |
| 313 | 59954 Netherlands Antilles - St. Maarten | |
| 314 | 59951 Netherlands Antilles - St. Maarten | |
| 315 | 59956 Netherlands Antilles - St. Maarten | |
| 316 | 59957 Netherlands Antilles - St. Maarten | |
| 317 | 59959 Netherlands Antilles - St. Maarten | |
| 318 | 599553 Netherlands Antilles - St. Maarten | |
| 319 | 599554 Netherlands Antilles - St. Maarten | |
| 320 | 18699 Nevis - Auckland | |
| 321 | 18693 Nevis - Christchurch | |
| 322 | 18693 Nevis - Dunedin | |
| 323 | 18697 Nevis - Hamilton | |
| 324 | 18696 Nevis - Hastings | |
| 325 | 18693 Nevis - Invercargill | |
| 326 | 18696 Nevis - Napier | |
| 327 | 18693 Nevis - Nelson | |
| 328 | 18696 Nevis - New Plymouth | |
| 329 | 186924 Nevis - New Zealand External Territories | |
| 330 | 18697 Nevis - North Island (Central and Eastern) | |
| 331 | 18699 Nevis - North Island (North) | |
| 332 | 18696 Nevis - North Island (Western) | |
| 333 | 18696 Nevis - Palmerston North | |
| 334 | 18699 Nevis - Pokeno | |
| 335 | 18697 Nevis - Rotorua | |
| 336 | 18693 Nevis - South Island | |
| 337 | 18697 Nevis - Tauranga | |
| 338 | 186927 Nevis - Telecom CDMAOne | |
| 339 | 186989 Nevis - Telecom Minicall Pager | |
| 340 | 186925 Nevis - Telecom Mobile (AMPS/DAMPS) | |
| 341 | 186926 Nevis - Telecom Pager | |
| 342 | 186929 Nevis - Telstra (GSM) | |
| 343 | 18693 Nevis - Timaru | |
| 344 | 186921 Nevis - Vodafone (GSM) | |
| 345 | 18696 Nevis - Wanganui | |
| 346 | 18694 Nevis - Wellington Region | |
| 347 | 18699 Nevis - Whangarei | |
| 348 | 687 New Caledonia | |
| 349 | 64 New Zealand - | |
| 350 | 649 New Zealand - Auckland | |
| 351 | 643 New Zealand - Christchurch | |
| 352 | 643 New Zealand - Dunedin | |
| 353 | 647 New Zealand - Hamilton | |
| 354 | 646 New Zealand - Hastings | |
| 355 | 643 New Zealand - Invercargill | |
| 356 | 646 New Zealand - Napier | |
| 357 | 643 New Zealand - Nelson | |
| 358 | 646 New Zealand - New Plymouth | |
| 359 | 6424 New Zealand - New Zealand External Territories | |
| 360 | 647 New Zealand - North Island (Central and Eastern) | |
| 361 | 649 New Zealand - North Island (North) | |
| 362 | 646 New Zealand - North Island (Western) | |
| 363 | 646 New Zealand - Palmerston North | |
| 364 | 649 New Zealand - Pokeno | |
| 365 | 647 New Zealand - Rotorua | |
| 366 | 643 New Zealand - South Island | |
| 367 | 647 New Zealand - Tauranga | |
| 368 | 6427 New Zealand - Telecom CDMAOne | |
| 369 | 6489 New Zealand - Telecom Minicall Pager | |
| 370 | 6425 New Zealand - Telecom Mobile (AMPS/DAMPS) | |
| 371 | 6426 New Zealand - Telecom Pager | |
| 372 | 6429 New Zealand - Telstra (GSM) | |
| 373 | 643 New Zealand - Timaru | |
| 374 | 6421 New Zealand - Vodafone (GSM) | |
| 375 | 646 New Zealand - Wanganui | |
| 376 | 644 New Zealand - Wellington Region | |
| 377 | 649 New Zealand - Whangarei | |
| 378 | 505 Nicaragua | |
| 379 | 227 Niger | |
| 380 | 234 Nigeria | |
| 381 | 683 Niue | |
| 382 | 672 Norfolk Island | |
| 383 | 1670 (Saipan, Rota, & Tinian) | |
| 384 | 47 Norway | |
| 385 | 968 Oman | |
| 386 | 92 Pakistan | |
| 387 | 680 Palau | |
| 388 | 970 Palestinian Settlements | |
| 389 | 507 Panama | |
| 390 | 675 Papua New Guinea | |
| 391 | 595 Paraguay | |
| 392 | 51 Peru | |
| 393 | 63 Philippines | |
| 394 | 48 Poland | |
| 395 | 351 Portugal | |
| 396 | 1787 Puerto Rico | |
| 397 | 1939 Puerto Rico | |
| 398 | 974 Qatar | |
| 399 | 262 Réunion Island | |
| 400 | 40 Romania | |
| 401 | 7472 Russia - Belgorod | |
| 402 | 7483 Russia - Bryansk | |
| 403 | 7492 Russia - Vladimir | |
| 404 | 7473 Russia - Voronezh | |
| 405 | 7493 Russia - Ivanovo | |
| 406 | 7401 Russia - Kaliningrad | |
| 407 | 7484 Russia - Kaluga | |
| 408 | 7494 Russia - Kostroma | |
| 409 | 7471 Russia - Kursk | |
| 410 | 7474 Russia - Lipetsk | |
| 411 | 7495 Russia - Moscow (municipal) | |
| 412 | 7496 Russia - Moscow (regional) | |
| 413 | 7486 Russia - Oryol | |
| 414 | 7491 Russia - Ryazan | |
| 415 | 7481 Russia - Smolensk | |
| 416 | 7475 Russia - Tambov | |
| 417 | 7482 Russia - Tver | |
| 418 | 7487 Russia - Tula | |
| 419 | 7485 Russia - Yaroslavl | |
| 420 | 250 Rwandese Republic | |
| 421 | 290 St. Helena | |
| 422 | 1869 St. Kitts/Nevis | |
| 423 | 1758 St. Lucia | |
| 424 | 508 St. Pierre & Miquelon | |
| 425 | 1784 St. Vincent & Grenadines | |
| 426 | 685 Samoa | |
| 427 | 378 San Marino | |
| 428 | 239 São Tomé and Principe | |
| 429 | 966 Saudi Arabia | |
| 430 | 221 Senegal | |
| 431 | 381 Serbia | |
| 432 | 248 Seychelles Republic | |
| 433 | 232 Sierra Leone | |
| 434 | 65 Singapore | |
| 435 | 421 Slovak Republic | |
| 436 | 386 Slovenia | |
| 437 | 677 Solomon Islands | |
| 438 | 252 Somali Democratic Republic | |
| 439 | 27 South Africa | |
| 440 | 34 Spain | |
| 441 | 94 Sri Lanka | |
| 442 | 249 Sudan | |
| 443 | 597 Suriname | |
| 444 | 268 Swaziland | |
| 445 | 46 Sweden | |
| 446 | 41 Switzerland | |
| 447 | 963 Syria | |
| 448 | 886 Taiwan | |
| 449 | 992 Tajikistan | |
| 450 | 25527 Tanzania - Arusha | |
| 451 | 25522 Tanzania - Dar Es Salaam | |
| 452 | 25526 Tanzania - Dodoma | |
| 453 | 25526 Tanzania - Iringa | |
| 454 | 25528 Tanzania - Kagera | |
| 455 | 25528 Tanzania - Kigoma | |
| 456 | 25527 Tanzania - Kilimanjao | |
| 457 | 25523 Tanzania - Lindi | |
| 458 | 25528 Tanzania - Mara | |
| 459 | 25525 Tanzania - Mbeya | |
| 460 | 255223 Tanzania - Morogoro | |
| 461 | 25523 Tanzania - Mtara | |
| 462 | 25528 Tanzania - Mwanza | |
| 463 | 25524 Tanzania - Pemba | |
| 464 | 25523 Tanzania - Pwani | |
| 465 | 25525 Tanzania - Rukwa | |
| 466 | 25525 Tanzania - Ruvuma | |
| 467 | 25528 Tanzania - Shinyanga | |
| 468 | 25526 Tanzania - Singida | |
| 469 | 25526 Tanzania - Tabora | |
| 470 | 25527 Tanzania - Tanga | |
| 471 | 25524 Tanzania - Zanzibar | |
| 472 | 66 Thailand | |
| 473 | 88216 Thuraya (Mobile Satellite service) | |
| 474 | 670 Timor Leste | |
| 475 | 228 Togolese Republic | |
| 476 | 690 Tokelau | |
| 477 | 676 Tonga Islands | |
| 478 | 1868 Trinidad & Tobago | |
| 479 | 216 Tunisia | |
| 480 | 90 Turkey | |
| 481 | 993 Turkmenistan | |
| 482 | 1649 Turks and Caicos Islands | |
| 483 | 380 Ukraine | |
| 484 | 971 United Arab Emirates | |
| 485 | 44 United Kingdom | |
| 486 | 1 United States of America | |
| 487 | 1340 US Virgin Islands | |
| 488 | 878 Universal Personal Telecommunications (UPT) | |
| 489 | 598 Uruguay | |
| 490 | 998 Uzbekistan | |
| 491 | 678 Vanuatu | |
| 492 | 39 Vatican City | |
| 493 | 379 Vatican City | |
| 494 | 58 Venezuela | |
| 495 | 84 Vietnam | |
| 496 | 808 Wake Island | |
| 497 | 681 Wallis and Futuna Islands | |
| 498 | 967 Yemen | |
| 499 | 260 Zambia | |
| 500 | 255 Zanzibar | |
| 501 | 263 Zimbabwe | |
| 502 | COUNTRYCODE; | |
| 503 | ||
| 504 | // Your 'Uganda' Line has both \t and 4 spaces | |
| 505 | ||
| 506 | $list = explode("\n", $areacodes);
| |
| 507 | ||
| 508 | - | list($dp, $country) = explode("\t", $entry);
|
| 508 | + | |
| 509 | - | $flist[$dp][] = $country; |
| 509 | + | |
| 510 | // Your tabs are actually 4 spaces | |
| 511 | - | krsort($flist); |
| 511 | + | list($dp, $country) = array_map('trim', explode(" ", $entry)); // Trim will clean up the extra whitespace
|
| 512 | ||
| 513 | // Check and see if it is set first, then add to it or create a new entry. | |
| 514 | - | $phone_number = $_GET['phone_number']; |
| 514 | + | if( isset( $flist[$dp] ) ){
|
| 515 | - | foreach ( $flist AS $prefix => $countries ) {
|
| 515 | + | $flist[$dp] .= ' & ' . $country; |
| 516 | - | if ( strpos($phone_number, (string)$prefix) === 0 ) {
|
| 516 | + | }else{
|
| 517 | - | $country = join(' or ', $countries);
|
| 517 | + | $flist[$dp] = $country; |
| 518 | - | |
| 518 | + | } |
| 519 | - | echo "Your number is from <b>{$country}</b> :: {$prefix}";
|
| 519 | + | |
| 520 | - | echo <<<EXP |
| 520 | + | |
| 521 | - | <pre>Sorry if this isn't accurate. I am still working on it. |
| 521 | + | |
| 522 | $phone_number = trim($_GET['phone_number']); // Remove whitespace | |
| 523 | ||
| 524 | if( isset( $flist[$phone_number] ) ){
| |
| 525 | - | </pre> |
| 525 | + | $region = $flist[$phone_number]; |
| 526 | $prefix = $phone_number; | |
| 527 | } else {
| |
| 528 | - | break; |
| 528 | + | krsort($flist); // No need to do it, wasting resources, before it is actually needed. |
| 529 | - | } |
| 529 | + | foreach ( $flist AS $prefix => $countries ) {
|
| 530 | - | } |
| 530 | + | if ( strpos($phone_number, (string)$prefix) === 0 ) {
|
| 531 | $region = $countries; | |
| 532 | break; | |
| 533 | } | |
| 534 | } | |
| 535 | } | |
| 536 | ||
| 537 | if(isset($region)){
| |
| 538 | $message = 'Your number (<span style="font-weight: bold;">' . $prefix . '</span>), is most likely from: "<span style="font-weight: bold;">' . $region . '</span>"<br>'; | |
| 539 | $message .= <<<EXP | |
| 540 | <p style="white-space: pre;">Sorry if this isn't accurate. I am still working on it. | |
| 541 | If the results are not accurate, please let me know at the address below. | |
| 542 | ||
| 543 | Please include the number that you were searching for, the results you expected and the results you actually got. | |
| 544 | </p> | |
| 545 | - | <input type="text" name="phone_number" value="" /> |
| 545 | + | |
| 546 | - | <input type="submit" value="Check" /> |
| 546 | + | |
| 547 | }else{
| |
| 548 | $message = 'No match was found for the entered number: "<span style="font-weight: bold;">' . $phone_number . '</span>"'; | |
| 549 | } | |
| 550 | }else {
| |
| 551 | $message = ''; | |
| 552 | } | |
| 553 | ||
| 554 | ||
| 555 | ?> | |
| 556 | ||
| 557 | <html> | |
| 558 | <head> | |
| 559 | <title>Country Phone Number Locator</title> | |
| 560 | </head> | |
| 561 | <body> | |
| 562 | Enter your number with the country code and let my program guess which country the number is for. | |
| 563 | <br /> | |
| 564 | <br /> | |
| 565 | <form> | |
| 566 | <input type="text" name="phone_number" value="" /> | |
| 567 | <input type="submit" value="Check" /> | |
| 568 | </form> | |
| 569 | <?php echo $message; ?> | |
| 570 | </body> | |
| 571 | </html> |