Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8057797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:08:59+00:00 2026-06-05T09:08:59+00:00

I am using the Google Api PHP Client. I want to get the details

  • 0

I am using the Google Api PHP Client.

I want to get the details of the user who has logged in.

I am setting the following Scopes

$client->setScopes('https://www.googleapis.com/auth/userinfo.profile');

$request = new apiHttpRequest("https://www.googleapis.com/oauth2/v1/userinfo?alt=json");
  $userinfo = $client->getIo()->authenticatedRequest($request);


  $response = json_encode(simplexml_load_string($userinfo->getResponseBody()));
  print "<pre>" . print_r(json_decode($response, true), true) . "</pre>";

But i am not able to get the jSON from the above code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:09:01+00:00Added an answer on June 5, 2026 at 9:09 am

    Wanted to Deleted the Question but didnt find any Answer that uses the PHP Client. so answering my own question

    Just by replacing

    $response = json_encode(simplexml_load_string($userinfo->getResponseBody()));
    

    by

    $response = $userinfo->getResponseBody();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the Google Api PHP client to Log the user in. I
I'm using the Zend_Gdata_Photos PHP client to access the Google Picasa API, trying to
I am using Google API - PHP client to connect to Google Analytics API.
I'm using a Google Analytics API Class in PHP made by Doug Tan to
I've read through the Google Spreadsheets API PHP documentation. All examples are using Zend,
I'm using GAPI library (in PHP) for querying Google Analytics API. I request 2
I need to download Gmail emails using php api. there APIs for google. i
I am using google api to get search result for certain queries in JSON
I'm using google api 15 on android emulator. I want to specify a country
I am using the following php class to convert text to speech: http://www.masnun.me/2009/12/14/googles-text-to-speech-api-a-php-wrapper-class.html its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.