tags:

views:

61

answers:

1

Hi, I'm using cakephp with this vendor: oauth_consumer.php
It requires OAuth PHP library oauth.php

Inside my controller, I successfully get a request token using a method call in oauth_consumer which successfully calls a static method in oauth.php:

$request = OAuthRequest::from_consumer_and_token($consumer, $token, $httpMethod, $url, $parameters);

However, when I get redirected back to my controller function google_callback() and call a method in oauth_consumer which calls a method in oauth.php, it reports me an error:

Call to undefined method OAuthUtil::parse_parameters()OAuthUtil::parse_parameters()

I'm confused as to why I am getting an undefined method error now, and yet before the redirect, the method call to oauth works just fine. I've checked the oauth.php file, and everything should check out just fine.

Solved: Putting in the full path in Require(...) fixed it...

+1  A: 

I just released my GData plugin at CakeFest at the weekend and it includes a component that handles the OAuth handshake.

It uses the HttpSocketOauth class I wrote which extends CakePHP's core HttpSocket class and is a simple robust way to make OAuth signed Http requests in Cake.

Might be of use to you.

I include some methods for working with YouTube and Google Analytics, but the GData plugin provides a framework for working with all the GData APIs. It's something that I'll be adding to as and when I get time and I hope the community contributes too. It would be ace if this became the de facto Cake plugin for GData in the same way that Zend Framework has the GData Services classes. Might you be interested in using the plugin with your project and extending it for your specific needs, then sharing the code back with the community?

To get an idea of the approach that I take in this plugin (and several other CakePHP plugins for consuming RESTful APIs) have a quick look in the YouTubeVideo model file.

neilcrookes
Awesome, thanks!
joslinm