MrToast
05-07-2005, 23:27
Hi all,
I'm trying to set up a page on my site to use libgmailer (http://gmail-lite.sourceforge.net/), an open source set of PHP classes for remotely connecting to Gmail.
What I'm trying to do is figure out how many invitations I have left. Unfortunately, nothing's working.
Here's the code of my main "gmail.php" file:
<?php
require_once("libgmailer.php");
$gmail = new GMailer();
$gmail->setLoginInfo("mrtoast@gmail.com","mypassword",0);
$gmail->connect();
$gmail->fetchBox(GM_STANDARD, "inbox", 0);
$info = $gmail->getInfo();
var_dump($info);
$gmail->disconnect();
?>
At first you may think "Oh, well your obvious problem is that there's no such function as "getInfo()". And you're right. Except that I've picked apart the code for Gallina, a gmail-based blogging system (http://ion.gluch.org.mx/files/Hacks/gallina/) and added the getInfo function to libgmailer:
function getInfo() {
$snapshot = $this->getSnapshot(GM_STANDARD);
$info = array();
if ($snapshot) {
$info["quota"]["MB"] = $snapshot->quota_mb;
$info["quota"]["Percentage"] = $snapshot->quota_per;
$info["invitations"] = $snapshot->have_invit;
$info["labels"] = $snapshot->label_list;
$info["total"] = $snapshot->box_total;
}
return $info;
}
Unfortunately, the var_dump is producing nothing but this:
array(4) {
["quota"]=>
array(2) {
["MB"]=>
NULL
["Percentage"]=>
NULL
}
["invitations"]=>
NULL
["labels"]=>
NULL
["total"]=>
NULL
}
If anyone has any experience with this, I'd love for someone to help me figure out where I'm screwing up. Feel free to IM me, email, post here, whatever.
Thanks!
Dave
I'm trying to set up a page on my site to use libgmailer (http://gmail-lite.sourceforge.net/), an open source set of PHP classes for remotely connecting to Gmail.
What I'm trying to do is figure out how many invitations I have left. Unfortunately, nothing's working.
Here's the code of my main "gmail.php" file:
<?php
require_once("libgmailer.php");
$gmail = new GMailer();
$gmail->setLoginInfo("mrtoast@gmail.com","mypassword",0);
$gmail->connect();
$gmail->fetchBox(GM_STANDARD, "inbox", 0);
$info = $gmail->getInfo();
var_dump($info);
$gmail->disconnect();
?>
At first you may think "Oh, well your obvious problem is that there's no such function as "getInfo()". And you're right. Except that I've picked apart the code for Gallina, a gmail-based blogging system (http://ion.gluch.org.mx/files/Hacks/gallina/) and added the getInfo function to libgmailer:
function getInfo() {
$snapshot = $this->getSnapshot(GM_STANDARD);
$info = array();
if ($snapshot) {
$info["quota"]["MB"] = $snapshot->quota_mb;
$info["quota"]["Percentage"] = $snapshot->quota_per;
$info["invitations"] = $snapshot->have_invit;
$info["labels"] = $snapshot->label_list;
$info["total"] = $snapshot->box_total;
}
return $info;
}
Unfortunately, the var_dump is producing nothing but this:
array(4) {
["quota"]=>
array(2) {
["MB"]=>
NULL
["Percentage"]=>
NULL
}
["invitations"]=>
NULL
["labels"]=>
NULL
["total"]=>
NULL
}
If anyone has any experience with this, I'd love for someone to help me figure out where I'm screwing up. Feel free to IM me, email, post here, whatever.
Thanks!
Dave