CodeIgniter Forums

Full Version: google api php client not loading
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]hacklan07[/eluser]
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:

Code:
<?
    class gcalendar extends Controller{
      
        function __construct() {
            parent::Controller();
            $this->load->model('user_model');
            $this->load->helper('url');
            $this->load->model('permissions_model');
          
            //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?

Thanks!

El Forum

[eluser]hacklan07[/eluser]
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...

El Forum

[eluser]hacklan07[/eluser]
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:

http://digitalpbk.com/codeigniter/use-ge...pplication