PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 2, 2022

[FIXED] How to Get 2 Digit Country Code by Using php

 July 02, 2022     php, xampp     No comments   

Issue

Hello Friends I was Developing an website which i only want to be viewed by Indian (People of india) , and I Want to Get The Two Digit Country Code for that using php. I browsed to http://php.net and tried using geoip_country_code_by_name , geoip_country_code3_by_name and geoip_country_name_by_name but None of Function worked , I have tried on my Existing XAMPP Installation and W3schools PHP runner but it says function not exists and i also have checked to PHP version. What Should i Do. I also Have tried methods form here and after Google(ing) whole day i finally came to ask here .


Feel Free to Suggest Edit or Close this Question


Solution

Based on some research, the best way seems to be by IP. This link will help you if you go this way. https://stackoverflow.com/a/13600004/13604954

But some VPN can easily change is on IP. ref. https://nordvpn.com/blog/vpn-ip-location-changer/

So good luck! 😉

The easiest way will be to asking the user is country and if not what you want, just show another page.



Answered By - Patfreeze
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing