-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal error: Uncaught Error: Class 'GooglePeople' ... Stack trace: #0 {main} thrown in #1
Comments
You need to use the use RapidWeb\GooglePeopleAPI\GooglePeople; Also, make sure you've gone through the setup section of the readme. :) |
Did you manage to get this working? |
Ah. I see you just opened #2. I'll take a look. |
@DivineOmega , I am very grateful for your time and help. I have solved it following your instructions. Again, thank you very much. This is the php code that works perfectly: require_once __DIR__ . '/vendor/autoload.php';
use RapidWeb\GooglePeopleAPI\GooglePeople;
use RapidWeb\GoogleOAuth2Handler\GoogleOAuth2Handler;
$clientId = '65...n.apps.googleusercontent.com';
$clientSecret = 'fc...X';
$refreshToken = '1...2V';
$scopes = ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/contacts', 'https://www.googleapis.com/auth/contacts.readonly'];
$googleOAuth2Handler = new GoogleOAuth2Handler($clientId, $clientSecret, $scopes, $refreshToken);
$people = new GooglePeople($googleOAuth2Handler);
// Retrieval all contacts
foreach($people->all() as $contact) {
echo $contact->resourceName.' - ';
if ($contact->names) {
echo $contact->names[0]->displayName . "<br>";
}
echo PHP_EOL;
} |
My php file show the next error:
Fatal error: Uncaught Error: Class 'GooglePeople' not found in /var/www/html/gcontacts/index.php:5 Stack trace: #0 {main} thrown in /var/www/html/gcontacts/index.php on line 5
index.php code:
require_once __DIR__ . '/vendor/autoload.php'; $people = new GooglePeople($GoogleOAuth2Handler);
php.ini display_errors are On
I do some wrong, please help!
The text was updated successfully, but these errors were encountered: