• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
google api php client not loading

I recently started using the google-api-php-client and have gotten it to work no problem. When I was satisfied with the basic functionality, I tried merging it into my codeigniter based website and so far haven't had any luck. Everything works until I try to load the google-api-php-client files from the codeigniter controller. I have put the google calendar api files in the 'application/libraries' folder within the codeigniter folder organization.

here's the code in the top of my controller:

    class gcalendar extends Controller{
        function __construct() {
            //import the google libraries
            echo "gcal constructor: line ".__LINE__."<br>";                                               //line 10
            $this->load->library('googleAPI/Google_Client');                                         //line 11
            $this->load->library('googleAPI/contrib/Google_CalendarService.php');         //line 12
            echo "gcal constructor: line ".__LINE__."<br>";                                               //line 13

This is what I get in a web browser:

gcal constructor: line 10
google client End Of File reached: line 473
google calendar client End Of File reached: line 1972

As you can tell, I've put an echo statement at the end of both of the google calendar api library files for debugging purposes. So, my question is how can codeigniter get to the last line of the library loaded in line 12, but not get to line 13? Am I loading the google-api-php-client files incorrectly? Should they not go in the libraries folder?


It turns out that CodeIgniter libraries need the class name to be the same as the imported library's file name. So, I renamed Google_CalendarService.php to Google_AclServiceResource.php and it loaded no problem! Now I just have to figure out how to make the google-api-php-client compatible with URL re-writing (the apache rewrite_module) so that it's fully compatible with codeigniter...

Aha! Google API uses OAuth which requires processing of $_GET data. To make CodeIgniter able to process $_GET data, make a simple change in our config.php file as seen here:


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.