i am newbie to google api and zend framework
i am using oath and zend framework to retrieve google contacts of my site's
member
i will use them to invite their friends kind of same way as facebook does
after applying a billion of P&C i somehow retrieved contact
but they are just name
like
deepak
sagrma
grake....
....
i am not having email id
my code for callback url is
session_start();
include 'connect.php';
$id=session_id();
//echo $id;
$query="SELECT * FROM session WHERE id = '$id'";
$qcresult=mysql_query($query);
$row= mysql_fetch_array($qcresult);
if(!$row)
{
$_SESSION['REQUEST_TOKEN']=$row['req_token'];
}
require_once 'Zend/Oauth/Consumer.php';
require_once 'Zend/Gdata/Docs.php';
$CONSUMER_KEY = '***************';
$CONSUMER_SECRET = '**********************';
// Multi-scoped token.
$SCOPES = array(
'http://www.google.com/m8/feeds/contacts/default/full/'
);
//echo "gotm ".$_SESSION['REQUEST_TOKEN'];
$oauthOptions = array(
'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER,
'version' => '1.0',
'consumerKey' => $CONSUMER_KEY,
'consumerSecret' => $CONSUMER_SECRET,
'signatureMethod' => 'HMAC-SHA1',
'callbackUrl' => 'http://techbits.co.in/mani/zend/library/ind2.php',
'requestTokenUrl' =>
'https://www.google.com/accounts/OAuthGetRequestToken',
'userAuthorizationUrl' =>
'https://www.google.com/accounts/OAuthAuthorizeToken',
'accessTokenUrl' => 'https://www.google.com/accounts/OAuthGetAccessToken'
);
$consumer = new Zend_Oauth_Consumer($oauthOptions);
if (!isset($_SESSION['ACCESS_TOKEN'])) {echo "in first if "."
";
if (!empty($_GET) && isset($_SESSION['REQUEST_TOKEN'])) { //echo "gotm
".$_SESSION['REQUEST_TOKEN']."
";
$_SESSION['ACCESS_TOKEN'] = serialize($consumer->getAccessToken($_GET,
unserialize($_SESSION['REQUEST_TOKEN'])));
}
}
//echo "fine "."
";
if (isset($_SESSION['ACCESS_TOKEN'])) {
$accessToken = unserialize($_SESSION['ACCESS_TOKEN']);
} else {
exit;
}
//echo " till ".$accessToken;
/* Or, you could set an existing token (say one stored from your database).
For HMAC-SHA1:
$accessToken = new Zend_Oauth_Token_Access();
$accessToken->setToken('1/AQfoI-qJDqkvvkf216Gc2g');
$accessToken->setTokenSecret('2c26GLW250tZiQ');
*/
$httpClient = $accessToken->getHttpClient($oauthOptions);
$client = new Zend_Gdata_Docs($httpClient);
// Retrieve user's list of Google Docs
$feed = $client->getDocumentListFeed(
'http://www.google.com/m8/feeds/contacts/default/full/');
foreach ($feed->entries as $entry) {
echo "$entry->title/n";
echo "
";
}
//echo "done";
?>
what should i do
any change in code is most welcome
when i have email i could use them to invite friends to my site.
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/contact-api-tp3346413p3346413.html
Sent from the Zend Framework mailing list archive at Nabble.com.