Finding Out Where Your Clients Come From...

By
Services for Real Estate Pros

UPDATED March 5th, 2011: This project is back on track and I will post the new information by March 30th, 2011.

As some of you know, I've been working on a I.P-based, geo-targeted advertising system.

This post is pretty technical, and I really don't expect anyone to read it, unless you are interested in my GeoZoodle widgets (like the one at the top of this post).  If you are a technical-type person, you'll probably enjoy this post. For everyone else, expect your eyes to glaze over very soon.

Right now, there is nothing at GeoZoodle.  I figure why launch the site, if it isn't working 100% correctly?

However, I did know that it was working about 95% correctly, so I offered some "widgets" to ActiveRainers.  Primarily, that welcome mat that you see on the right side of my blog.  You can still get the code to the Welcome Mat if you send me an email with the phrase "geo location" in the subject line. (don't worry about sending a message; you'll get an auto-reply).

It's pretty cool if you are in the 95% who see the proper state displayed on the mat.

However, I've received about 5 emails from people for whom GeoZoodle doesn't "work".  Or, in other words, it doesn't display the proper city or state.  Many of you have expressed concerns that there may be something wrong with your computer.

There is nothing wrong with your computer.  And for my cowardly detractors (who bad-mouth me in other forums), there is nothing wrong with my code.  I would think, before speaking in ignorance about me, you would know how to program in PHP yourself and had an understanding of this.  If you had an understanding, you would know that there is no bug and the site "works" just fine.

The code is short, simple and 100% bug free.

So why doesn't the GeoZoodle widget work for some of you?  Are some of you seeing the wrong state at the top of this post?  Or maybe on my right-side welcome mat?

--- This next part is pretty boring; if you are happy with your widget, you probably don't want to bother. ---

Just to set your minds at ease, here is how GeoZoodle (or any online geographic targeting system works):

First, I get your I.P. address as soon as you visit this page.  It's very simple to do; it's literally only one line of code.  Just Google "code for get I.P" or something and you can see it for yourself.

Next, there is a database stored on GeoZoodle.  This is not a database that I created, but one that I purchased from a well-known data provider.  Picture the database as an Excel Spreadsheet...an enormous Excel spreadsheet that contains over 3,000,000 rows.

Once I get your I.P., I take the "dots" out, so that I can make it into a real number.  For those of you that know what an I.P looks like, it's not a "real" number...  Aw heck, I'll just show you your I.P. address; it's so simple.  This is your very own, unique-to-your-computer I.P. address:

Your Browser is incompatible to view this image. Sorry!

Now, with one simple line of code, I remove the "dots" in your I.P.  In this database (again, picture an enormous Excel Spreadsheet), it has rows and rows of data.  A row of data looks like this:

[start IP] [end IP] [city] [state_or_region] [country] [zip_code]

So, once I have your I.P., I just issue a command to the database that looks something like this:

Select the row of data, where my user's IP address lands between "start IP" and "end IP".  Now, display the user's city and state based on the "row" it finds with the I.P.

So the million dollar question:  Why doesn't GeoZoodle work properly for some users?

Simply put:  Because creating a database that contains every city in the entire world is an arduous task, at best.  The data mining company that I purchased the database from is updating it each and every day.  For the rest of my life, I will get monthly updates to the database, which means GeoZoodle will become more and more accurate each month.

However, I am not that patient.  I am currently working on a method to update the database myself.  (This is actually more complex than it sounds.) I don't intend to wait around for the database company to slowly update it.  They could be working on I.P. addresses in Vietnam right now, for all I know.  (Remember, this is a world-wide database.)

For those of you that want GeoZoodle widgets and real estate solutions for your site, know that this will be working very, very soon.  I have some phenomenal ideas to help agents and loan officers and I will unveil the finished product no later than the first of the new year.

Thanks for reading this post! I hope you are still awake!

Posted by

seo guru

Comments (73)

Rita Taylor
None - Sanford, NC
Sanford NC Real Estate - Homes for Sale in Sanford North Carolina

Karen,

I get odd results once in a while for this widget and on the AR home page.  The AR home page shows the top people in your state.  Once in a while (like this evening) both of these think I am in Ohio instead of North Carolina. 

Sep 27, 2007 01:22 PM
Brad Andersohn
Executive Director of Education at eXp Realty - Fairfield, CA
ActiveBrad - 707.646.1876
Karen - Love it, love you! Looking forward to ANYTHING you bring to the table in the near or distant future.  My welcome mat is getting a lot of traffic, might have to start leaving the shoes outside! LOL! :-)
Sep 30, 2007 03:12 AM
Pat Hommel
Annapolis Plaza CB Residential and Commercial - Annapolis, MD
Annapolis, AA Co., Md. Real Estate Sales
Karen,   You are so amazing!!  I can't wait to see GeoZoodle.  I am not asleep after reading this post, my mind is now on super drive....what will you have next?  I will try to do this welcome mat, however, I admit I am not a real wizard (yet) so I may have to write to you and Brad (remember Brad you offered to help me) to get through the welcome mat installation.  I will work at this after Monday, I am out of town in a country location with limited connection.  Karen, You Inspire Me!
Sep 30, 2007 07:06 AM
Alan Kirkpatrick
Austin Texas Homes - Round Rock, TX
Alan in Austin

Hi Karen:

 

Enjoyed this too. It was techie at the end but that is ok, my wife says I have that glazed eye look all the time anyway.

Oct 02, 2007 09:05 AM
Cyndee Haydon
Charles Rutenberg Realty - Clearwater, FL
727-710-8035 Clearwater, Beach Short Sales Luxury Condos &Homes

Karen - LOL - I'm obviously confusing the Welcome Mat because everywhere I go it' says welcome to our GEORGIA vistors - I thought - why is everyone welcoming Georgia visitors - what did I miss - obviously alot.

So how do you get this widget? I wanna play too!!!(Only if I'm not too late)

You are one smart ladie - even with all those tumors in your brain - see if people bad mouth you you can now say - I can out think YOU with 9 tumors in my brain - ok, I hope I know you well enough to joke about it girlfriend to girlfriend (:-) - no offense intended. Just feeling spunky like old times.

Oct 02, 2007 04:10 PM
SEO Expert: Michael George
Phoenix, AZ
Real Estate and Law Firm SEO

Hi Cyndee--

You know that I can't be offended!  I am about << THIS >> close to fixing it so it says "Florida" for you and not Georgia.  Very close now...

Good to "see" you again!

Karen

Oct 03, 2007 06:59 AM
Cyndee Haydon
Charles Rutenberg Realty - Clearwater, FL
727-710-8035 Clearwater, Beach Short Sales Luxury Condos &Homes
Hey Girl - LOL - Now I'm a New Jersey Visitor - which would probalby be true for the snow birds here :-) - You're a better woman than me to be playing with all that code - I have my CIS degree but am happy to have friends like you be the expert!!! :-)  
Oct 05, 2007 03:37 PM
Bill Gassett
RE/MAX Executive Realty - Hopkinton, MA
Metrowest Massachusetts Real Estate
Hi Karen - I hope you are well! I just noticed that your geozoodle is not working on my site or yours for that matter. Is there something wrong with it? Thought you should know.
Oct 23, 2007 07:43 AM
Bill Gassett
RE/MAX Executive Realty - Hopkinton, MA
Metrowest Massachusetts Real Estate
Oh ya one other thing - How do I make it to your link list :)
Oct 23, 2007 07:45 AM
Fred Carver Personal Real Estate Corporation
RE/MAX Camosun Victoria BC Real Estate - Victoria, BC
Accredited Real Estate Consultant

Hi Karen...How's your Project coming, we're all keen to see and support your New Baby in 2008!

HAPPY NEW YEAR!

Dec 30, 2007 04:41 PM
Anonymous
Karen Lauler
The top of the page says  "I Love Marylanders"  but I am from Pennsylvania.
Apr 28, 2008 03:15 AM
#64
Anonymous
devdaslover

to find your ip address visit   www.what-is-my-ip-address.net

Sep 21, 2008 02:32 PM
#65
Mark Brian
Silver Star Real Estate LLC - Anderson, SC
Anderson SC Realtor

I love it! No more muddy footprints on my website! I can't wait to install it, hope it works on my site! Thank you very much!

Sep 25, 2008 12:50 PM
Anonymous
pinayspeak

Most of the blog widgets, Myspace layouts, and Myspace backgrounds out there are pretty junky. We think the danasoft graphic is a much more stylish way to jazz up your Myspace profile, your blog, or your website, and there's no better way to freak people out and make them think that you are publishing their private info.

<a href="http://pinayspeak.com">busby seo test</a>

Oct 01, 2008 08:54 PM
#68
Richard Stabile
Re/Max Real Estate Limited - Oradell, NJ
Bergen County New Homes Builder Realtor

Keep it up, your doing fine. Nothing that is worth it is easy.

Richard

Oct 02, 2008 12:48 AM
George Tars
PalmHomes LLC - Palm Beach, FL

<?php


$vars = explode('|',$_COOKIE['geouser']);
foreach($vars AS $value)
 {
       $value = explode('=', $value);
       $$value[0]=$value[1];
}

 

 

$DatabaseServer = "localhost";
$Username = "geozoodl_ben";
$Password = "98almaknotXYZ";
$DatabaseName = "geozoodl_ip2location";
 
$link = mysql_connect($DatabaseServer, $Username, $Password) or die('Could not connect: ' . mysql_error());

mysql_select_db($DatabaseName) or die('Could not select database');
   


if (getenv(HTTP_X_FORWARDED_FOR)) {
      $ip   = getenv('HTTP_X_FORWARD_FOR');
      $host = gethostbyaddr($ip);
    } else {
      $ip   = getenv('REMOTE_ADDR');
      $host = gethostbyaddr($ip);
   }

 

 $tmp = explode(".", $ip);

            $w = (16777216 * $tmp[0]);
            $x = (65536 * $tmp[1]);
            $y = (256 * $tmp[2]);
            $z = $tmp[3];

            $ipno =  $w+ $x + $y + $z;

$query = "SELECT * FROM ipcitylatlongzip WHERE $ipno <= endIpNum AND $ipno >= startIpNum";

$result = mysql_query($query) or die("IP2Location Query Failed");

// Retrieve the recordset (only one)

$row = mysql_fetch_object($result);

// got my row of data

 

 

//assign variables to field names
$country = $row->country;
$abcountry = $row->countryShort;
$cityname = $row->city;
$countrylong = $row->country;
$latitude = $row->latitude;
$longitude = $row->longitude;
$zipcode = $row->zipcode;
$state = $row->region;
$fullstate = $row->region;


//capitalize State
$fullstate = strtolower($fullstate);
$fullstate = substr_replace($fullstate, strtoupper(substr($fullstate, 0, 1)), 0, 1);

//capitalize city

$cityname = ucwords(strtolower($cityname));

//capitalize country
$countrylong = ucwords(strtolower($countrylong));

 


?>

 

----

when i clicked at the link to visit geozoodle.com

in the header part I show all the PHP code of the mysql_fetch_object() function

you need to fix that also your connection to the database ... write a dbconnect.php file and include it

so the credentials are not exposed

 ---

also for the above code to disappear from the header part you need to save the index.html as index.php

Oct 04, 2008 08:04 AM
George Tars
PalmHomes LLC - Palm Beach, FL

I found that this website http://www.maxmind.com/

has reliable database for IP address fir sale

Oct 04, 2008 08:07 AM
George Tars
PalmHomes LLC - Palm Beach, FL

// Warning: gethostbyaddr() [function.gethostbyaddr]: Address is not a valid IPv4 or IPv6 address in /home/geozoodl/public_html/correct_info.php on line 36

fix also this  on line 36 of correct_info.php

 

Oct 04, 2008 08:15 AM
George Tars
PalmHomes LLC - Palm Beach, FL

also from some comment in the php.net site

Be careful using HTTP_X_FORWARDED_FOR in conditional statements collecting the IP address. Sometimes the user's LAN address will get forwarded, which of course is pretty worthless by itself.  

Oct 04, 2008 08:38 AM
SEO Expert: Michael George
Phoenix, AZ
Real Estate and Law Firm SEO

George--


Thanks a bunch.  I am using the Maxmind DB.  This is actually my wife's site (Geozoodle) and she passed away on Aug. 23.

I'm not very rich right now, with Karen passing away, but could I pay you to help me out with this?

Michael George

Oct 06, 2008 04:59 AM

What's the reason you're reporting this blog entry?

Are you sure you want to report this blog entry as spam?