How to get country from webpage
Hi! Well I need to get the country automatically from code to show in my app. Well, I found this page: http://api.hostip.info/country.php which gives to you the country code like I need. But I don´t know if there are any form to get this from code. I hope someone can help me. Thanks in advance.
Re: How to get country from webpage
Is this a visual c++ question or a web page scripting question??
Re: How to get country from webpage
Visual c++ question. I only want to know if it is possible to get the country name from a web page like the one I put before or it´s impossible. Or download the content as string or txt...
Re: How to get country from webpage
How is it a Visual C++ question?
Re: How to get country from webpage
Quote:
Originally Posted by
varis
Visual c++ question. I only want to know if it is possible to get the country name from ...
May I ask you why you need it?
Re: How to get country from webpage
Quote:
Originally Posted by
VictorN
May I ask you why you need it?
For my app. I have a label who tell the country of the user and I want to get from that page but I don´t know how to.
Right, it´s a visual C++ question, I´m using c++ on visual studio 2010. I can´t understand why people still thinking that I´m not using c++ xD, and why is important.
Re: How to get country from webpage
Define "the country of the user".
And who is about to provide this information?
Re: How to get country from webpage
Well, in that page, tells you the country (in this form: US, UK, ES...) where you live from your ip, and I need exactly that.
Re: How to get country from webpage
Then use WinInet API to connect to http://api.hostip.info/country.php or any similar site to obtain country name.
Or you could download and then use the database containing country names with the IP Addresses:
http://www.developerfusion.com/artic...ddress-how-to/
Re: How to get country from webpage
I guess, URLDownloadToFile function is the simplest way for you to get that info. Save it to some file in %TEMP% folder, and read it whenever you need it.
Re: How to get country from webpage
Hi again. Thanks for the answers. I found URLDownloadToFile more easier to use but I have a problem. If I create a new project works perfect, but If I use on my project I have a problem with UrlMon.h.
UrlMon.h: No such file or directory
But I don´t know why I have this problem in one project and not in the other :S. I have the directory C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include in the project aswell.
Any idea?
Re: How to get country from webpage
Ok, was a mistake of linking librarys. All works perfect now. Thanks for the replies and help :)