+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009
    Location
    United Kingdom
    Posts
    489
    Downloads
    0
    Uploads
    17
    Blog Entries
    2

    Default Geographical location of visitors

    Maybe some of you want to use the geographical location of visitors, for different purposes. For this you need to process geographical location from one of the sites have a database that provides information approximate.

    In this article we will draw the country (and city) of origin and geographical location on IPinfodb

    In one of our recent articles we have learned how to take over a page's response. In this article we learned when we use the function to retrieve the site's response.
    Code:

    <?php

    function getGeoLocation()
    {
    $response = getResponsePage("http://ipinfodb.com/ip_query.php?ip=".$_SERVER['REMOTE_ADDR']);

    preg_match("/<Latitude>(.*?)<\/Latitude>/",$response,$lat);
    preg_match("/<Longitude>(.*?)<\/Longitude>/",$response,$long);

    $location = $lat[1].",".$long[1];

    return htmlspecialchars($location);
    }
    ?>

    To find out the geographic location all you have to do is to appeal getGeoLocation function ().
    Code:

    <?php

    function getGlobalLocation()
    {
    $response = getResponsePage("http://ipinfodb.com/ip_query.php?ip=".$_SERVER['REMOTE_ADDR']);
    preg_match("/<CountryName>(.*?)<\/CountryName>/",$response,$country);

    return htmlspecialchars($country[1]);
    }
    ?>

    To find the location of the world (country) will have to resort getGlobalLocation function ().

  2. WebmasterServe Adverts:
  3. #2

    Default

    Thank YOu.....This is very good....I will surely use this

  4. #3

    Default

    Another option would be to use the google maps API to get exact locations via longitude and latitude

  5. #4

    Default

    this is good..nice..i will work on it...

+ Reply to Thread

Similar Threads

  1. 10,000 Unique Visitors - $6.99
    By smartadspace in forum Buy, Sell or Trade
    Replies: 18
    Last Post: 04-10-2010, 03:01 PM
  2. Using SEO and Google Trends got me over 12,000 visitors in 24 hours
    By articleenterprise in forum Search Engine Optimisation
    Replies: 0
    Last Post: 03-30-2009, 06:59 AM
  3. 50,000 visitors to your site - FREE!
    By flishess in forum Buy, Sell or Trade
    Replies: 0
    Last Post: 09-27-2005, 02:40 AM
  4. Replies: 0
    Last Post: 07-12-2005, 08:18 AM
  5. Replies: 0
    Last Post: 05-14-2005, 03:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110