|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
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();
?>
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;
}
Code:
array(4) {
["quota"]=>
array(2) {
["MB"]=>
NULL
["Percentage"]=>
NULL
}
["invitations"]=>
NULL
["labels"]=>
NULL
["total"]=>
NULL
}
Thanks! Dave |
|
#2
|
|||||
|
|||||
|
Re: libgmailer experience?
Quote:
Code:
if (isset($raw["i"][1])) $this->have_invit = $raw["i"][1]; Code:
function getInfo() {
$raw = array(
"i" => array(TRUE),
"gn" => array(TRUE),
"v" => array(TRUE)
);
$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;
}
EDIT (Again): Just looked over the code, and $this->have_invit is set from the array put in as a parameter, so I don't think you can get the amount of invites from calling this function =( Maybe some creative use of sockets and regular expression functions would let you parse the info out? Last edited by Mike : 05-07-2005 at 23:55. |
|
#3
|
|||||
|
|||||
|
Re: libgmailer experience?
I think that $raw IS set, because I call:
$gmail->fetchBox(GM_STANDARD, "inbox", 0); Looking through this, we see it fires: Code:
$this->fetch($q); Code:
$this->raw = $packets; In this same fetch function, the data returned from GMail is in the $inbox variable. I shot it out to HTML via: Code:
echo "<textarea>".$inbox."</textarea>"; Code:
<script>top.location="https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%3Fui%3Dhtml%26zy%3Dl";</script> Thanks! Dave |
|
#4
|
|||||
|
|||||
|
Re: libgmailer experience?
Try echo'ing out $this->raw after it's set in fetch()
|
|
#5
|
|||||
|
|||||
|
Re: libgmailer experience?
It's an empty array:
Code:
array(0) { }
![]() Dave |
|
#6
|
|||||
|
|||||
|
Re: libgmailer experience?
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| worst experience | mike pawlak | Chit-Chat | 15 | 06-12-2004 07:04 |
| Your Worst FIRST experience | Richomundo | General Forum | 54 | 18-07-2004 23:02 |
| A testimony to my unique FIRST experience: | Ken Leung | General Forum | 22 | 14-04-2004 20:45 |
| FIRST was an awesome experience for our rookie team (team overview) | TheGreatPF | General Forum | 6 | 05-04-2004 00:15 |
| 2003 IRI: A driver's last hurrah or a new rookie driver's experience? | Amanda Morrison | Off-Season Events | 14 | 23-05-2003 17:39 |