0

I'm trying to integrate Google Drive API with my WordPress site as I want to list folders by their names not their IDs, I've found this link https://developers.google.com/drive/api/v3/quickstart/php that describes how to work with the API using PHP, I uploaded google-api-php-client-2.4.1 folder to my root directory where wp-config.php file is, and used "Code Snippets" plugin to embed the code in quickstart.php and changed the corresponding parts of linking to autoload.php file here

<?php
require __DIR__ . '/vendor/autoload.php';

if (php_sapi_name() != 'cli') {
    throw new Exception('This application must be run on the command line.');
}

And uploaded the credentials.json file in place as the link says, however I'm getting the error that it must run on the command line and I can't figure my way out as I've never used the command line with WordPress before, sorry if I'm a little bit noobish in my question but I'm trying to figure a way out where I can embed/integrate the Google Client API correctly with my WordPress in order to use it in my PHP snippets

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.