Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Facebook PHP SDK version #46

Closed
adiramardiani opened this issue Mar 13, 2016 · 4 comments
Closed

Update Facebook PHP SDK version #46

adiramardiani opened this issue Mar 13, 2016 · 4 comments

Comments

@adiramardiani
Copy link

Actualy Facebook PHP SDK is v5

@adiramardiani
Copy link
Author

I think with this SDK can provide for example get and post method and will be better if this module can implement new method like FbGet and FbPost, for example with standard code :

$fb = new Facebook\Facebook([
      'app_id'                => 'app id',
      'app_secret'            => 'app secret',
      'default_graph_version' => 'v2.5',
    ]);

    if(isset($_SESSION['token'])){
        $id = $_POST['pageid'];
        $message = $_POST['message'];
        $h = $_POST['hour'];
        $m = $_POST['minutes'];
        $s = $_POST['seconds'];
        $d = $_POST['date'];
        $month = $_POST['month'];
        $y = $_POST['year'];

        //More handy to connect graph with get method
        $res = $fb->get('/me/accounts', $_SESSION['token']);
        $res = $res->getDecodedBody();

        foreach($res['data'] as $page){
            if($page['id'] == $id){
                $accesstoken = $page['access_token'];
                break;
            }
        }

        $time = strtotime($month . '-' . $d . '-' . $y . ' ' . $h . ':' . $m . ':' . $s);
        $data = array(
                'message' => $message,
                'scheduled_publish_time' => $time,
                'published' => 'false'
        );
        //More handy to post status or scheduling with post method
        $res = $fb->post($id . '/feed/', $data, $accesstoken);  
    }

@adiramardiani
Copy link
Author

If update to v5 is a BC breaking, how to add get or post (to post status or scheduling) method with v4 way ?
Sorry I'm new in php, I cannot create a pull request :(

$social = Yii::$app->getModule('social');
$social->fbGet('/me/accounts', $_SESSION['token']);

or

$social = Yii::$app->getModule('social');
$data = [
   'message' => $message,
   'scheduled_publish_time' => $time,
   'published' => 'false'
];
$social->fbPost($id . '/feed/', $data, $accesstoken); 

@kartik-v
Copy link
Owner

Get updated release v1.3.2 where the extension has been modified to use Facebook SDK 5.0.

Refer updated docs & demos.

@adiramardiani
Copy link
Author

Coolllll, thank you !!! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants