Tell me please what do you use for the variable xmlresponse? I am
using. such a code to get contact information:
require_once ('google-api-php-client/src/apiClient.php');
$ Client = new apiClient ();
$ Client-> setApplicationName ('Google Contacts PHP Sample');
$ Client-> setScopes ("
http://www.google.com/m8/feeds/");
/ / Documentation:
http://code.google.com/apis/gdata/docs/2.0/basics.html
/ / Visit
https://code.google.com/apis/console?api=contacts to
generate your
/ / Oauth2_client_id, oauth2_client_secret, and register your
oauth2_redirect_uri.
$ Client-> setClientId ('somecode');
$ Client-> setClientSecret ('somecode');
$ Client-> setRedirectUri ('somecode');
/ / $ Client-> setDeveloperKey ('insert_your_developer_key');
if (isset ($ _GET ['code'])) {
$ Client-> authenticate ();
$ _SESSION ['Token'] = $ client-> getAccessToken ();
$ Redirect = 'http://'. $ _SERVER ['HTTP_HOST']. $ _SERVER
['PHP_SELF'];
header ('Location:'. filter_var ($ redirect, FILTER_SANITIZE_URL));
}
if (isset ($ _SESSION ['token'])) {
$ Client-> setAccessToken ($ _SESSION ['token']);
}
if (isset ($ _REQUEST ['logout'])) {
unset ($ _SESSION ['token']);
$ Client-> revokeToken ();
}
if ($ client-> getAccessToken ()) {
$ Req = new apiHttpRequest ("
https://www.google.com/m8/feeds/
contacts/default/full") ;/ / create requests string contacts /
default / full
/ / $ Req = new apiHttpRequest ("
http://schemas.google.com/
contacts/2008/rel # photo") ;/ / create requests string
$ Val = $ client-> getIo () -> authenticatedRequest ($ req);
print "<pre>";
print_r ($ val);
print "</ pre>";
/ / The contacts api only returns XML responses.
$ Response = json_encode (simplexml_load_string ($ val->
getResponseBody ()));
print "Debugging code for Google API <pre>". print_r (json_decode ($
response, true), true). "</ Pre>";
/ / The access token may have been updated lazily.
$ _SESSION ['Token'] = $ client-> getAccessToken ();
} Else {
$ Auth = $ client-> createAuthUrl ();
}
if (isset ($ auth)) {
print "<a class=login href='$auth'> Connect Me! </ a>";
} Else {
print "<a class=logout href='?logout'> Logout </ a>";
}
___________
How to follow the code of your part of the code to display a list of
contacts, emails and not merely the title and content???