Search

Rss Posts

Rss Comments

Login

 

Creating a mashup

Aug 24

Fun and troublesome!
Mashup in progress

Issues:

  1. Installing PEAR on shared GoDaddy server, thanks to Abby and Win’s Blog
  2. Getting Zillow data (easy!)
  3. Altering GoogleMapAPI.class.php (from phpinsider.com)
    1. Moving from PEAR DB to MDB2 (what I used for reference because DB is deprecated in the latest version of PEAR)
    2. changed function getCache:
      function getCache($address) {
      if(!isset($this->dsn)) return false;
      $_ret = array();
      // PEAR MDB2
      require_once("MDB2.php");
      $_db =& MDB2::connect($this->dsn);
      if (PEAR::isError($_db)) {
      die($_db->getMessage() . ', ' . $_db->getDebugInfo());
      }
      if (PEAR::isError($_db)) {
      die($_db->getMessage(). ', ' . $_db->getDebugInfo());
      }
      $_res =& $_db->query("SELECT lon,lat FROM {$this->_db_cache_table} where address = '$address'");
      if (PEAR::isError($_res)) {
      die($_res->getMessage(). ', ' . $_res->getDebugInfo());
      }
      if($_row = $_res->fetchRow()) {
      $_ret['lon'] = $_row[0];
      $_ret['lat'] = $_row[1];
      }
      $_db->free();
      return !empty($_ret) ? $_ret : false;
      }
    3. changed function putCache:
      function putCache($address, $lon, $lat) {
      if(!isset($this->dsn) || (strlen($address) == 0 || strlen($lon) == 0 || strlen($lat) == 0))
      return false;
      // PEAR MDB2
      require_once("MDB2.php");
      $_db =& MDB2::connect($this->dsn);
      if (PEAR::isError($_db)) {
      die($_db->getMessage() . ', ' . $_db->getDebugInfo());
      }
      $_res =& $_db->query("insert into ".$this->_db_cache_table." values ('$address', $lon, $lat)");
      if (PEAR::isError($_res)) {
      die($_res->getMessage());
      }
      $_db->free();
      return true;
      }
    4. GoogleMap API (easy once I figured it liked addresses better than the lat/long Zillow was returning…)

Stay tuned for more developments…

To do:

  1. fix line-height of superscripted registration mark
  2. integrate multiple listings
  3. integrate search
  4. integrate 2 other (maybe 3?) API’s to be named later

Post a comment

You must be logged in to post a comment.