Thursday, November 27, 2014

Get Country of IP Address with PHP

Standard





I'm trying to put together a PHP script that I can query from any web browser and it returns the Country of the IP address that accessed the PHP script


There are various web APIs that will do this for you. Here's an example using http://ipinfo.io:


          $ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}"));
echo $details;

  








 Here's an example using http://www.geoplugin.net/json.gp





$ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip={$ip}"));
echo $details;

      







90 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    Texting API
    Text message marketing
    Digital Mobile Marketing
    Mobile Marketing Services
    Mobile marketing companies
    Fitness SMS

    ReplyDelete
  3. Very interesting,good job and thanks for sharing such a good blog.your article is so convincing that I never stop myself to say something about it.You’re doing a great job.Keep it up

    PSD to Wordpress
    wordpress website development

    ReplyDelete
  4. This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
    rpa training in bangalore
    best rpa training in bangalore
    RPA training in bangalore
    rpa course in bangalore
    rpa training in chennai
    rpa online training

    ReplyDelete
  5. Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    Python Online certification training
    python Training institute in Chennai
    Python training institute in Bangalore

    ReplyDelete
  6.   I’ve bookmarked your site, and I’m adding your RSS feeds to my Google account.
    python training in chennai
    python course in chennai
    python training in bangalore

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    python training in rajajinagar
    Python training in bangalore
    Python training in usa

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.

    AWS Training in Bangalore | Best AWS Amazon Web Services…
    Amazon Web Services Training in Pune India
    AWS Online Training in India | AWS Training | AWS online training
    AWS Training in Bangalore | Aws training in Bangalore with placements

    ReplyDelete
  11. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    AWS Training in pune
    AWS Online Training
    AWS Training in Bangalore

    ReplyDelete
  12. I am really enjoyed a lot when reading your well-written posts. It shows like you spend more effort and time to write this blog. I have saved it for my future reference. Keep it up the good work.
    mi service center in chennai
    redmi service center in chennai
    xiaomi service centre chennai
    redmi service center
    mi service center
    redmi service center near me

    ReplyDelete
  13. I think this is the best article today about the future technology. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future
    mobile service centre
    mobile service center in chennai
    mobile service center chennai
    mobile service centre near me
    mobile service centre chennai
    best mobile service center in chennai
    best mobile service center in chennai

    ReplyDelete
  14. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    honor mobile service center in chennai
    honor mobile service center
    honor mobile service centre in Chennai
    honor service center near me

    ReplyDelete
  15. Your blog’s post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts.
    redmi note service center in chennai
    redmi service center in velachery
    redmi service center in t nagar
    redmi service center in vadapalani

    ReplyDelete
  16. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you.
    Keep update more information..
    moto g service center in chennai
    motorola service center in velachery
    motorola service center in t nagar
    motorola service center in vadapalani

    ReplyDelete
  17. This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points.
    apple service center chennai
    apple service center in chennai
    apple mobile service centre in chennai
    apple service center near me

    ReplyDelete
  18. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definitely interested in this one. Just thought that I would post and let you know. Nice! thank you so much! Thank you for sharing.
    lg mobile service center in chennai
    lg mobile service center
    lg mobile service chennai
    lg mobile repair
    lg mobile service center near me

    ReplyDelete
  19. Waow this is quite pleasant article, my sister love to read such type of post, I am going to tell her and bookmarking this webpage. Thanks Ce site

    ReplyDelete
  20. Thanks for a nice share you have given to us with such an large collection of information.
    Great work you have done by sharing them to all. for more info
    simply superb.PGDCA class in bhopal
    autocad in bhopal
    3ds max classes in bhopal
    CPCT Coaching in Bhopal
    java coaching in bhopal
    Autocad classes in bhopal
    Catia coaching in bhopal

    ReplyDelete
  21. Thanks for sharing informative information

    Thanks
    Cpa offers

    ReplyDelete
  22. for azure training in hyderabad you can learn through azure training in hyderabad

    ReplyDelete
  23. Thank you so much for sharing this amazing article with us. Will stay connected with your blogs for the future posts.
    Python training in bangalore
    Python training in Bangalore

    ReplyDelete
  24. For IOT Training in Bangalore Visit: IOT Training in Bangalore

    ReplyDelete
  25. I really enjoy reading this article.Hope that you would do great in upcoming time.A perfect post.Thanks for microsoft azure sharing.microsoft azure training in bangalore

    ReplyDelete
  26. I think this is an informative post and it is very beneficial and knowledgeable. Therefore, I would like to thank you for the endeavors that you have made in writing this article. All the content is absolutely well-researched. Thanks... ISO 9001 toolkit

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. We as a team of real-time industrial experience with a lot of knowledge in developing applications in python programming (7+ years) will ensure that we will deliver our best in python training in vijayawada. , and we believe that no one matches us in this context.

    ReplyDelete
  29. Thanks for sharing such a great information..Its really nice and informative..

    azure online training

    ReplyDelete
  30. Very informative blog and useful article thank you for sharing with us...
    AWS Training in Bangalore

    ReplyDelete
  31. This is so elegant and logical and clearly explained. Brilliantly goes through what could be a complex process and makes it obvious.

    cyber security online training

    ReplyDelete
  32. This comment has been removed by the author.

    ReplyDelete
  33. The blog is very useful and informative thanks for sharing MS azure

    ReplyDelete
  34. Thanks for the informative article About Python.This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete
  35. Much Needed informative Blogs are Here...The Blogs are having Highly Technical Contents to enhance the enlightenment, Thanks for sharing and keep sharing

    python training in chennai | python training in annanagar | python training in omr | python training in porur | python training in tambaram | python training in velachery

    ReplyDelete
  36. Therefore, you can opt for the right institute to take a course and gain more knowledge in the field. This will help you gain the expertise and get better at what you do. best machine learning course in hyderabad

    ReplyDelete
  37. I agree with a lot of the points you made in this article. I appreciate the work you have put into this and hope you continue writing on this subject.
    SAP training in Kolkata
    SAP training Kolkata
    Best SAP training in Kolkata
    SAP course in Kolkata

    ReplyDelete
  38. Yes, Without SEO, no one can survive online.
    So why our team of SEO agencies in Bangalore focus completely on Off-page and On-page SEO optimization.If anyone wants to hire us, please feel free to reach us @ weblogicks.com.

    ReplyDelete
  39. Good Post! , it was so good to read and useful to improve my knowledge as an updated one, keep blogging.After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.
    https://www.3ritechnologies.com/course/aws-amazon-web-services/

    ReplyDelete
  40. We have seen many blog but this the great one, Thanks for provide great informatic and looking beautiful blog, really nice required information & the things i never imagined and i would like to request, wright more blog and blog post like that for us. Thanks you once agian

    birth certificate in delhi
    birth certificate in noida
    birth certificate in ghaziabad
    birth certificate in gurgaon
    birth certificate agent in delhi
    marriage registration in delhi
    marriage certificate in delhi
    correction in 10th mark sheet
    marriage registration in ghaziabad
    marriage registration in gurgaon

    ReplyDelete
  41. This Mila Moursi powerful line of skin care products are founded in the best of science, nature and decades of expertise to restore and maintain healthy skin. In Mila Moursi using peptides and plant stem cells, this advanced lifting serum provides you with an immediate glow while smoothing wrinkles. Check Out Mila moursi reviews for full details about this perfect and cool skin care product. It works by firming skin and preventing further laxity. Beloved by A-list celebrities and image-makers for years, Mila Moursi products care for skin with lavish French sensorial qualities, allowing you to start each day with a truly pampering self-care ritual.

    ReplyDelete
  42. thank you for sharing we are looking forward for more
    aws Training in Hyderabad

    ReplyDelete
  43. "This is really interesting, you are such a great blogger. Visit Royal Digitech for creative and professional website design and Digital Marketing in Sirsa
    and Also get Digital Marketing Course in Sirsa
    "

    ReplyDelete
  44. Doron Gil, Ph.D., is an Expert on Self-Awareness and Relationshipsweb361.fr capturedcurrentnews.com

    ReplyDelete
  45. Redmi is tipped to launch the Redmi K50 series in February 2022. Which means this phone launch next in starting in February .click here for this news Redmi K40 Gaming Gets Approved In China
    For All News Click Here Nindia24

    ReplyDelete
  46. Samsung’s Galaxy Tab S8 family is supposed to arrive soon . This Tab  have a pretty good idea of the specification and design. @_snoopytexh_ Posted A Tweet on twitter That this Samsung Galaxy Tab S8 is here to fill in the gaps and those gaps would be the color options and memory variants. Samsung Galaxy Tab S8 Memory Configuration Revealed

    ReplyDelete
  47. Reading news was quite boring earlier but reading it from your website is interesting and time saving because you provide it in a very confined way. You can also check my website FASTHARYANANEWS - HARYANA KI TAZA KHABRE HINDI ME for fast Haryana news that it provides you with Legitd information in a very specified manner. Apart from this you canFAST also read all the news HARYANA NEWS - HARYANA K SATH DESH DUNIYA KI TAZA KHABRE HINDI MEIN in simple Hindi language that can be understood easily and can keep you up to date.

    ReplyDelete
  48. I go to your blog much of the time and direction it to the total of people who wanted to highlight on happening their comprehension resulting to ease. The way of composing is stunning and in addition to the substance material is culmination score. gratitude for that discernment you give the perusers! FileViewPro

    ReplyDelete
  49. Your substance material is nothing prompt of throbbing in bunches of ways. I guess this is alluring and eye-start texture. much obliged accurately a huge amount for stressing generally your substance material and your perusers. Happy Friday Images And Quotes

    ReplyDelete
  50. I think I have never seen such blogs ever before that has complete things with all details which I want. So kindly update this ever for us.
    full stack developer course with placement

    ReplyDelete
  51. wordpress website design agency in united states Need professional WordPress Web Design Services? We're experts in developing attractive mobile-friendly WordPress websites for businesses. Contact us today!

    ReplyDelete