Welcome Guest, Not a member yet? Register   Sign In
Integrate Facebook Php Client
#1

[eluser]thachp[/eluser]
Trying to integrate Facebook Php Client to Igniter. Any suggestions on how to do that? Copying their files to system/libraries does seems to work for me.

http://developers.facebook.com/resources.php

Patrick
#2

[eluser]Unknown[/eluser]
same problem here. Has anyone successfuly implemented the facebook api library into CI?
#3

[eluser]mohrt[/eluser]
Yes, I just launched my first facebook app today.

http://apps.facebook.com/motortopia/

The only snafu I ran into was $_GET var clobbering by CI. I had to replace them in the controller. Here is a snippet:

Code:
class F8 extends Controller {
  function F8()
  {
    parent::Controller();
    // work around CI GET clobbering
    parse_str($_SERVER['QUERY_STRING'],$_GET);
    
    if($this->uri->segment(2) !== 'remove_app')
      require_once APPPATH.'/scripts/facebook_client/appinclude.php';
  }
  function index()
  {
     // you should use view files here, etc
     echo "Welcome!";
     // see all the $_POST data the Facebook environment gives you
     print_r($_POST);
  }
}

I dumped all the facebook client data in one directory then included the appinclude.php from the constructor.

My callback URL looks like http://www.mydomain.com/f8/

Anytime you call a URL like http://apps.facebook.com/myapp/foo/bar/blah, the callback URL fetched by Facebook will be http://www.mydomain.com/f8/foo/bar/blah

My post-remove URL is http://www.mydomain.com/f8/remove_app

The post-remove URL cannot include the appinclude.php file, thus the segment check.
#4

[eluser]niyogi[/eluser]
Hi mohrt:

Trying to get an IFRAME based facebook app going on the CI framework. I'm wondering [a] where the appinclude.php file should go [b] what it should contain and [c] how to work around the auth_token querystring annexation that facebook lops onto the end of IFRAME changes. Can you possibly post the content of your appinclude.php (excluding the apikey/secret details of course) and help out on the auth_token issue?

Thanks in advance!

Regards,
Roj
#5

[eluser]mohrt[/eluser]
The appinclude.php is basically the same one that ships with the facebook client, there were no CI-specific changes made. I didn't do anything with the auth_token issue, I just repopulated $_GET as in my example above.

I have not tried an iframe app, btw.
#6

[eluser]niyogi[/eluser]
Ah - I had to really hack CodeIgniter to work as an IFRAME framework for Facebook app development. querystring urls are necessary (since they append fb session data to the end of each url) as is the necessity to change permitted uri characters in the config.php file.

Other than that, loving being on CI. :-)

Roj
#7

[eluser]neelp[/eluser]
niyogi,

can you describe what you hacked in order to get it working for an iframe app?

thanks.
#8

[eluser]codelearn[/eluser]
[quote author="mohrt" date="1183112309"]Yes, I just launched my first facebook app today.

The only snafu I ran into was $_GET var clobbering by CI. I had to replace them in the controller. Here is a snippet:
[/quote]

Mohrt,

I am still being clobbered with the crap facebook throws in on the callback URL.

Example: http://www.mycampuslinks.com/fbook?auth_...f24ddf4e83

I'm using your controller as well, and including appinclude just like you did.

Any help you can give me here?
#9

[eluser]mohrt[/eluser]
What isn't working? My solution puts the get vars back into $_GET because CI strips them out.
#10

[eluser]codelearn[/eluser]
Maybe I implemented it incorrectly... but could you try going here: http:/www.mycampuslinks.com/fbook

Here is my controller:
Code:
<?php
    
class Fbook extends Controller {
  function Fbook()
  {
    parent::Controller();
    // work around CI GET clobbering
    parse_str($_SERVER['QUERY_STRING'],$_GET);
    
    if($this->uri->segment(2) !== 'remove_app')
      require_once APPPATH.'/scripts/facebook_client/appinclude.php';
  }
  function index()
  {
     // you should use view files here, etc
     echo "Welcome!";
     // see all the $_POST data the Facebook environment gives you
     print_r($_POST);
  }
}

?>




Theme © iAndrew 2016 - Forum software by © MyBB