Adding google api client to codeigniter

I want to upload files to Google Drive using php in codeigniter. First of all, I am trying to integrate google api client into codiginator.

I uploaded all the files to my third_party folder. it looks like this

enter image description here

I created a file with a name google.phpinside my folderlibraries

google.php file

        <?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 I loaded the library into my home controller, like this

        function __construct() {
            parent::__construct();

          //session, url, satabase is set in auto load in the config
            $this->load->model('Home_model', 'home');
            $this->load->library('pagination');
            $this->load->library('google');

        }

After downloading to the google library, none of the functions inside the home controllers work. Every thing just shows a blank page.

And inside the home controller, I have a test_lib function

    function test_lib(){

        echo $this->google->getLibraryVersion(); 
   }

When I load the page. I get a black page with no errors or impressions.

Can someone help me add google api client library to codeigniter. Tnx.

+4
2

, , Google/autoload.php /-. APPPATH . 'third_party/Google/autoload.php'.

+6

, , , Google.php , , , . php Client.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/autoload.php';

   class Google extends Google_Client {
      function __construct($params = array()) {
       parent::__construct();
      }
   }

, , ,

 $this->load->library('google');

echo - lib

     echo $this->google->getLibraryVersion();   

- 1.1.5 ..

0

All Articles