Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] How can I call a Google Application using CI4
#1

(This post was last modified: 05-18-2021, 12:02 AM by John_Betong.)

I have developed a couple of PHP online websites using Google Books API and struggling to get the API to work with CI4.

With PHP I use Composer to download the API then the following couple of lines and it works a treat:

Code:
require_once '/var/www/ci2/vendor/autoload.php';

$tmpUrl = 'https://console.cloud.google.com/home/dashboard?project=PROJECT_NO_GOES_HERE;

$GOOGLE_API_PROJECT_ID = 'API-KEY-GOES-HERE';

 // CI4 ==> "Class "App\Controllers\Google_Client" not found"
 $client = new Google_Client();
Reply
#2

Did you add a use path\Google_Client ?

Also you may need a backslash \Google_Client();
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

@InsiteFX,
> Did you add a use path\Google_Client ?
Using require_once '/var/www/ci2/vendor/autoload.php'; worked.

I could not set namespace and/or use?

> Also you may need a backslash \Google_Client();
Many thanks the problem was the missing leading backslash.

I've experienced the same problem earlier (since using CI4 namespaces) and had forgotten Sad
Reply




Theme © iAndrew 2016 - Forum software by © MyBB