Reputation: 677
when i use APPPATH.'libraries/Google/Client.php', all the files which are included in require_once, the sub file i.e(Auth/AssertionCredentials.php)
A PHP Error was encountered
Severity: Warning
Message: require_once(Google/Auth/AssertionCredentials.php): failed to open stream: No such file or directory
Filename: Google/Client.php
Line Number: 18
Upvotes: 9
Views: 4407
Reputation: 5416
Copy the "Google" folder to third_party.
Create new file under application/library called google.php
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
set_include_path(APPPATH . 'third_party/' . PATH_SEPARATOR . get_include_path());
require_once APPPATH . 'third_party/Google/Client.php';
class Google extends Google_Client {
function __construct($params = array()) {
parent::__construct();
}
}
Then to use:
$this->load->library('google');
echo $this->google->getLibraryVersion();
Upvotes: 16
Reputation: 4634
You can change to the libraries path, require the google client, then switch back to the CI default path..
// change directory to libraries path
chdir(APPPATH.'libraries');
// include API
require_once('Google/Client.php');
// do some stuff here with the Google API
// switch back to CI default path
chdir(FCPATH);
Upvotes: 2