Fetching Contacts

Help
tmac22
2008-10-27
2013-04-03
  • tmac22
    tmac22
    2008-10-27

    I'm using the cvs version to try to get my contacts

    Here's the script

    <?php
        require("libgmailer.php");
           $gm = new GMailer();
           $D_FILE="debug.log";
           $D_ON=true;
           $gmail_acc = "acc";
           $gmail_pwd = "pwd";
           $my_timezone = -6;

           $gm->setLoginInfo($gmail_acc, $gmail_pwd, $my_timezone);
           if ($gm->connect()) {
                echo "status ".$gm->lastActionStatus()."<br>\n";
            $gm->fetchBox(GM_CONTACT, "all", 0);
                echo "status ".$gm->lastActionStatus()."<br>\n";
            $snapshot = $gm->getSnapshot(GM_CONTACT);
            var_dump($snapshot);
               echo "status ".$gm->lastActionStatus()."<br>\n";
            if (!empty($snapshot->contacts)) {
                echo "Your frequently used addresses:<br>\n";
                          foreach ($snapshot->contacts as $item) {
                        echo "Name: " . $item["name"] . " Email: " . $item["email"] . "\n";
                         }
                      }
           } else {
               echo "unable to connect ".$gmailer->lastActionStatus()."\n";
           }

           var_dump($_SESSION);
    ?>

    The log says
    <?php /** FAILED to read id_key from server. **/ ?>

    and the var_dump of the snapshot says
    object(GMailSnapshot)[2]
      public 'created' => int 0
      public 'snapshot_error' => string 'Invalid response from Gmail (empty)' (length=35)

    I tried a couple patches
    http://easywww.wordpress.com/2008/10/01/php-libgmailer-patch/
    http://dev.notoptimal.net/2007/11/new-gmail.html