rhyspaterson Posted September 27, 2007 Share Posted September 27, 2007 Hey guys, iplocatethis.com is a netgeo tool that maps an IP address to it's (general) location. The way it's done is the page returns a longitude and latitude for a submitted IP address. What i wanted to do was to get the data the site returns and store it as a PHP variable. http://www.iplocatethis.com/location.php?ip=203.22.30.33 If you then look at the page source you can see the XML data. What i wanted to know was, how can i get the XML data and store it (in the quickest and most effective way)? Any functions that can help me? Cheers, /Rhys Quote Link to comment https://forums.phpfreaks.com/topic/70971-return-data-from-iplocatethiscom/ Share on other sites More sharing options...
MadTechie Posted September 27, 2007 Share Posted September 27, 2007 probably pasre the page, using http://uk2.php.net/manual/en/function.file-get-contents.php http://uk2.php.net/manual/en/ref.xml.php then store in a database maybe... the most effective way really depends what you want to do with it, Quote Link to comment https://forums.phpfreaks.com/topic/70971-return-data-from-iplocatethiscom/#findComment-356812 Share on other sites More sharing options...
rhyspaterson Posted September 27, 2007 Author Share Posted September 27, 2007 Basically i will be pulling about 2,500 IP address from a database (which makes me wonder if IP locate this can handle all those requests, but anyway), i then convert them to lat/long and plot them using google maps Quote Link to comment https://forums.phpfreaks.com/topic/70971-return-data-from-iplocatethiscom/#findComment-356858 Share on other sites More sharing options...
MadTechie Posted September 28, 2007 Share Posted September 28, 2007 or just search for a prebuilt database http://www.google.com/search?hl=en&ie=UTF-8&q=ip+to+latitude+database http://www.google.com/search?hl=en&ie=UTF-8&q=ip+to+city+database http://ip-to-country.webhosting.info/ good luck in your quest //<--where did that come from ? Quote Link to comment https://forums.phpfreaks.com/topic/70971-return-data-from-iplocatethiscom/#findComment-356863 Share on other sites More sharing options...
dingus Posted September 28, 2007 Share Posted September 28, 2007 if you wanted an easy solution my best sergestion as fare as getting the data would be use CURL to get the page its self as it in to a veriable given all you want to do is receave the data as is it isnt all that hard find some details on how to do this here http://au2.php.net/curl once you have it simple use preg match more information on this here http://au.php.net/preg_match but you could probably get away with somthing as simple as $lat = preg_match("/lat=\"(.*)\"", $Body, $matches); would give you the veriable.... what do you think? Quote Link to comment https://forums.phpfreaks.com/topic/70971-return-data-from-iplocatethiscom/#findComment-356881 Share on other sites More sharing options...
MadTechie Posted September 28, 2007 Share Posted September 28, 2007 personally i would use http://uk2.php.net/manual/en/ref.xml.php as that what is designed for in this case but instead of DDOSing another server which is probably breaking the T&C's just download your own database Quote Link to comment https://forums.phpfreaks.com/topic/70971-return-data-from-iplocatethiscom/#findComment-356882 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.