facebook-php-sdk

Posts scheduled via Graph API frequently do not get published

守給你的承諾、 提交于 2019-12-01 06:20:33
Hi I'm using facebook php sdk to make posts to my fanpage. I am attempting to schedule these posts to the future. I am running into some problems though. Here is my code <?php // This code is just a snippet of the example.php script // from the PHP-SDK <https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php> require_once('facebookphp/src/facebook.php'); $app_id = "xxxxx"; $app_secret = "xxxxxx"; // Create our Application instance (replace this with your appId and secret). $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'fileUpload' => true, )

Failed to connect to graph.facebook.com port 443: Network unreachable

半城伤御伤魂 提交于 2019-12-01 05:21:14
<?php session_start(); //included file and use $app_id = 'xxx'; $app_secret = 'xxx'; FacebookSession::setDefaultApplication($app_id, $app_secret); $helper = new FacebookRedirectLoginHelper("`http://example/facebook4.0`/", $app_id, $app_secret); try { $session = $helper->getSessionFromRedirect(); } catch(FacebookRequestException $ex) { } catch(Exception $ex) { } $loggedIn = false; if (isset($session)) { if ($session) { $loggedIn = true; try { //logged here and get data $user_profile = (new FacebookRequest( $session, 'GET', '/me' ))->execute()->getGraphObject(GraphUser::className()); print_r(

How to upload multiple images to one post in facebook via api

喜夏-厌秋 提交于 2019-12-01 05:13:53
So. I can't make this work and i can't find any solution about this. Here is my code. $result1 = $facebook->batchApi('***********/feed', 'POST', array( 'attached_files' => $facebook->attachFile($uploads[2]), )); $result2 = $facebook->batchApi('*********/feed', 'POST', array( 'attached_files' => $facebook->attachFile($uploads[1]), )); $res = $facebook->processBatch(array( "access_token" => $user_profile['data'][0]['access_token'], )); I'm using facebook-batch-api . It's just simple wrapper for batch requests. Need make post like this https://www.facebook.com/centrMAN/posts/587573351326832 You

Facebook PHP SDK - getUser() suddenly returns 0

馋奶兔 提交于 2019-12-01 03:51:18
First of all, to get this out of the way, I've spent hours looking through answers to this question here on StackOverflow, and tried to solve it on my own, but it just isn't working (anymore). So anyway... Yesterday, everything worked fine. Went to bed, woke up, login with facebook didn't work anymore on 2 of my websites. The login link sends me to the Facebook page which requires me to approve the App, but after it redirects me back to the site, it doesn't log me in. I quickly tracked the problem to getUser() always returning 0. So I set up a new (test) app with a very very basic code, just

How to upload multiple images to one post in facebook via api

坚强是说给别人听的谎言 提交于 2019-12-01 02:46:56
问题 So. I can't make this work and i can't find any solution about this. Here is my code. $result1 = $facebook->batchApi('***********/feed', 'POST', array( 'attached_files' => $facebook->attachFile($uploads[2]), )); $result2 = $facebook->batchApi('*********/feed', 'POST', array( 'attached_files' => $facebook->attachFile($uploads[1]), )); $res = $facebook->processBatch(array( "access_token" => $user_profile['data'][0]['access_token'], )); I'm using facebook-batch-api. It's just simple wrapper for

Facebook application refresh automatically

混江龙づ霸主 提交于 2019-12-01 01:59:53
My application refreshs automatically to facebook login url but my user already signed in so repeats refresh, nonstop. Here is my code $facebook = new Facebook(array( 'appId' => 'my app id', 'secret' => 'my secret key', 'cookie' => true, )); $session = $facebook->getSession(); $fbme = null; $loginUrl = $facebook->getLoginUrl( array( 'canvas' => 1, 'fbconnect' => 0, 'next' => 'my app uri', 'cancel_url' => 'my app uri', 'req_perms' => 'email,publish_stream,status_update,offline_access,user_birthday' ) ); if (!$session) { echo "<script type='text/javascript'>top.location.href = '$loginUrl';<

Facebook PHP SDK - getUser() suddenly returns 0

一个人想着一个人 提交于 2019-12-01 01:30:57
问题 First of all, to get this out of the way, I've spent hours looking through answers to this question here on StackOverflow, and tried to solve it on my own, but it just isn't working (anymore). So anyway... Yesterday, everything worked fine. Went to bed, woke up, login with facebook didn't work anymore on 2 of my websites. The login link sends me to the Facebook page which requires me to approve the App, but after it redirects me back to the site, it doesn't log me in. I quickly tracked the

Facebook PHP-SDK with CodeIgniter not returning $_REQUEST['signed_request']

与世无争的帅哥 提交于 2019-11-30 23:42:54
class Example extends CI_Controller { function __construct() { parent::__construct(); } function index() { $this->load->library('facebooklib'); $user = $this->facebooklib->getUser(); if ($user) { try { $data['user_profile'] = $this->facebooklib->api('/me'); } catch (FacebookApiException $e) { $user = null; } } var_dump($_REQUEST); if ($user) { $data['logout_url'] = $this->facebooklib->getLogoutUrl(); } else { $data['login_url'] = $this->facebooklib->getLoginUrl(); } $this->load->view('view',$data); } } After clicking on the Login link, I am taken to Facebook permissions page, I accept, and I

Facebook API: Can't retrieve Facebook Lead Ads

泄露秘密 提交于 2019-11-30 21:58:41
问题 I have set up successfully a webhook to point to my callback URL and it receives the following example data: Array ( [object] => page [entry] => Array ( [0] => Array ( [id] => 297269987142139 [time] => 1454876106 [changes] => Array ( [0] => Array ( [field] => leadgen [value] => Array ( [ad_id] => 410908499427 [adgroup_id] => 238113717077 [created_time] => 1454847306 [form_id] => 577581087825 [leadgen_id] => 441393665441 [page_id] => 297269987142139 ) ) ) ) ) ) But if I try to retrieve the

Facebook application refresh automatically

ぃ、小莉子 提交于 2019-11-30 21:19:55
问题 My application refreshs automatically to facebook login url but my user already signed in so repeats refresh, nonstop. Here is my code $facebook = new Facebook(array( 'appId' => 'my app id', 'secret' => 'my secret key', 'cookie' => true, )); $session = $facebook->getSession(); $fbme = null; $loginUrl = $facebook->getLoginUrl( array( 'canvas' => 1, 'fbconnect' => 0, 'next' => 'my app uri', 'cancel_url' => 'my app uri', 'req_perms' => 'email,publish_stream,status_update,offline_access,user