Community Forums/Get help with Kontagent/PHP Client Library

Answered

New Facebook API support

Magnus Jonsson
asked this on May 10, 2010 02:06 pm

SInce Facebook have changed it's libraries and APIs how does this affects the provided PHP Kontagent library?
Read about the changes here: http://developers.facebook.com/docs/guides/upgrade 

Does the PHP Kontagent library work against the new PHP SDK library from Facebook (http://github.com/facebook/php-sdk)?

 

Comments

User photo
Gaurav Khurana
orangecorn

I have the same question. How do we use kontagent for dashboard news and activity API?

May 12, 2010 03:18 pm.
User photo
Jimmy Fan
Kontagent

We are working on a new PHP client library based on the new Facebook PHP SDK to make it more convenient to instrument your apps.  The code and doc should be ready in a matter of weeks.  In the meantime, feel free to browse the code and play around with it: http://github.com/kontagent/php-sdk 

In any case, you could still directly use the underlying Web Services REST API, which also provides more flexibility.  More details here: http://developers.kontagent.com/getting-started/instrumenting-your-...

May 27, 2010 07:07 am.
User photo
Lih Chen
Kontagent

I've been working on the new kontagent php library based off of the new fb php sdk.  If you've already played around with the new facebook sdk, you'll see that the require_login() call is missing. I added that back in there in our library since I think you guys need it for the authorization process. In any case, I will check in my documentation (a text file) so far on git later today, so you guys can read more about it. 

 

Lih 

June 01, 2010 12:25 pm.
User photo
James Baker
Funtank

Hi Lih. Any update on this? When can we expect a fully working version to run off the new facebook sdk? We have instrumented our test application with your github code in its current state. We have everything working except for installs and removes, I understand this is where alot of trouble comes into play with regards to the updated facebook authentication system. Should these calls work by following the existing documentation in github? If not, Do you plan on releasing a working version anytime soon, or are we on our own to instrument these calls.

Thanks

 

Thanks

August 09, 2010 10:48 am.
User photo
Jiri Kopsa
subject.cz

Yeah, any update on this?

August 20, 2010 12:33 pm.
User photo
Lih Chen
Kontagent

Hi all, 

The version on github is the working version.  James Baker, please forward me your questions in regards to tracking installs.  I'll help you to get that working. Remove, on the other hand, has stopped working, since Facebook has stopped sending the necessary facebook user information to track that properly.

August 20, 2010 03:23 pm.
User photo
Ryan Donaldson
THQ

Hi Lih,

I just downloaded the latest Kontagent and the latest facebook php code, and they don't seem compatible.  Kontagent is trying to make this call: $fb->api_client->admin_getAppProperties(...), but the version of facebook.php I just grabbed doesn't have an api_client object, and it's not an obvious fix.

Any ideas?

cheers,

Mike

September 29, 2010 07:43 pm.
User photo
Ryan Donaldson
THQ

Hi - so I found it.  The Documentation on the Kontagent website appears to be all wrong.  It sent me to kontagent-php-client-library and NOT php-sdk - you guys might want to update the documentation....

 

cheers,

Mike (pretending to be Ryan)

September 29, 2010 08:01 pm.
User photo
Erik Walle
2K Games

ya, you guys have to take that old stuff down. It's very confusing. Hello?

October 12, 2010 09:00 am.
User photo
Jimmy Fan
Kontagent

Hi there, 

We will be overhauling our documentation soon to catch up with the evolution of our product.  In the meantime, the links have been fixed.  

Thanks for your understanding and for helping each other out! 

October 12, 2010 09:18 am.
User photo
Carlos Parodi
SocialApps, LLC

Hi,

I've downloaded the latest PHP client library and am also using the latest Facebook client library.  When I access the example PHP file provided in you PHP SDK on the canvas page of my app I'm getting this error:

PHP Fatal error:  Call to undefined method Facebook::get_facebook_url() in /var/www/html/facebook/client/facebookapi_php5_restlib.php on line 83

 

I've gone through the code and there is no reference to using the old library so i'm baffled as to why I'm getting this error.

 

Any suggestions?

 

Thanks.

November 16, 2010 09:58 am.
User photo
Carlos Parodi
SocialApps, LLC

Scratch that... I found where it's trying to use the old Facebook API.

 

In kt/config.php (generated by running php -f kt_setup.php)

includes an_client/kt_facebook.php

includes an_client/ktapi_php5_rest_lib.php

includes ../facebookapi_php5_restlib.php

 

Is this what it's supposed to do?  The reason I ask is the files in an_client/ were not included in the SDK zip file that I downloaded.

November 16, 2010 10:05 am.
User photo
Carlos Parodi
SocialApps, LLC

Ok, found the problem.  Apparently my mistake was following the instruction to generate the kt_config.php file by running php -f kt_setup.php which was in the instructions on instrumenting your application.

November 16, 2010 10:34 am.
User photo
Carlos Parodi
SocialApps, LLC

I did find a bug in kt_facebook.php however.  If the user has given offline permissions to the app I get an error at line 148 (in bold):

$session = array('access_token' => $oauth_struct[0]->access_token,
                                 'session_key' => $_REQUEST['fb_sig_session_key'],
                                 //'expires'=> $oauth_struct[0]->expires,
                                 'uid' => $uid);

$session = array('access_token' => $oauth_struct[0]->access_token,                                
'session_key' => $_REQUEST['fb_sig_session_key'],                                
'expires'=> $oauth_struct[0]->expires,                                
'uid' => $uid);

$oauth_struct[0]->expires does not exist in this scenario so to fix this I changed the code to:

$session = array('access_token' => $oauth_struct[0]->access_token,

                                 'session_key' => $_REQUEST['fb_sig_session_key'],

                                 //'expires'=> $oauth_struct[0]->expires,

                                 'uid' => $uid);

// If user has offline permissions granted to the app expires property does not exist

                if (isset($oauth_struct[0]->expires)) {

                  $session['expires'] = $oauth_struct[0]->expires;

                }

 

I've attached my modified kt_facbook.php file.

November 16, 2010 10:41 am.
User photo
Erik Walle
2K Games

people are still getting tripped up following the old tutorial? based on FB code from like a year ago?

 

you guys should really take that down!

November 16, 2010 10:50 am.