View Single Post
  #1   Spotlight this post!  
Unread 05-07-2005, 23:27
MrToast's Avatar
MrToast MrToast is offline
I named Greg Needel's cat!
AKA: Dave DeLong
no team (Rhode Warriors)
Team Role: Alumni
 
Join Date: Mar 2004
Rookie Year: 2004
Location: RI, now UT
Posts: 326
MrToast has much to be proud ofMrToast has much to be proud ofMrToast has much to be proud ofMrToast has much to be proud ofMrToast has much to be proud ofMrToast has much to be proud ofMrToast has much to be proud ofMrToast has much to be proud of
Send a message via AIM to MrToast
libgmailer experience?

Hi all,

I'm trying to set up a page on my site to use libgmailer, 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:
Code:
<?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 and added the getInfo function to libgmailer:
Code:
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:
Code:
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
__________________
(#121, 2004) Archimedes semi-finalists with 237 and 386! I had an awesome time guys, and thanks for the hat!
(#121, 2004) BC5 semi-finalists with 190 and 1027! Awesome time! We went further than I thought we could! Thanks for all your help w/ our transmission!
(#121, 2005) Galileo quarter-finalists with 47 and 203! Thanks for all your support through the stress!
------------------------------
If it moves and it shouldn't, use duct tape.
If it doesn't move and it should, use WD-40
------------------------------
"It'll all work out in the end, and if it doesn't, it's not the end." - Jeff Bullock
Reply With Quote