0

Hello Friends, I made a facebook app that will upload photos in new album. I configured facebook app and wrote code. It works fine for the Test User. Now as i can see, the publish_actions is approved as there is not sign of error on the permission. But it still not work for the all user only work for Test users.

I am sharing you code:-

$fb = new Facebook\Facebook(['app_id' => 'xxxxxxxxxxxx',
  'app_secret' => 'xxxxxxxxxxxxxxxxxxxx',
   'default_graph_version' => 'v2.2',
 ]);
 $helper = $fb->getRedirectLoginHelper();
 try {
       $accessToken = $helper->getAccessToken();
 } catch(Facebook\Exceptions\FacebookResponseException $e) {
       echo 'Graph returned an error getting TOKEN : ' . $e->getMessage();
       exit;
    } catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
if (isset($accessToken)) {
 // Logged in!
 $_SESSION['facebook_access_token'] = (string) $accessToken;
 $fb->setDefaultAccessToken($accessToken);
 $batch = [
       'photo-one' => $fb->request('POST', '/'.$albId.'/photos', [
       'message' => 'Foo photo',
       'source' => $fb->fileToUpload('img/2.jpg'),
       ]),
      'photo-two' => $fb->request('POST', '/'.$albId.'/photos', [
      'message' => 'Fool photo',
      'source' => $fb->fileToUpload('img/1.jpeg'),
       ])
      ];
      try {
       $responses = $fb->sendBatchRequest($batch);
      } catch(Facebook\Exceptions\FacebookResponseException $e) {
       // When Graph returns an error
        echo 'Graph returned an error UP PICS: ' . $e->getMessage();
        exit;
       } catch(Facebook\Exceptions\FacebookSDKException $e) {
      // When validation fails or other local issues
       echo 'Facebook SDK returned an error: ' . $e->getMessage();
     exit;
    }
    foreach ($responses as $key => $response) {
     if ($response->isError()) {
       $e = $response->getThrownException();
       echo '<p>Error! Facebook SDK Said: ' . $e->getMessage() . "\n\n";
       echo '<p>Graph Said: ' . "\n\n";
       var_dump($e->getResponse());
      } else {
       echo "<p>(" . $key . ") HTTP status code: " . $response->getHttpStatusCode() . "<br />\n";
echo "Response: " . $response->getBody() . "</p>\n\n";
echo "<hr />\n\n";

} }

enter image description here

Sumit
  • 31
  • 7
  • 3
    Neither of those two permissions are approved, since you have not even submitted them for review yet. – CBroe Oct 13 '15 at 12:17
  • Will you please Suggest me the way how can i submit for review . Because Submit for review is disabled. – Sumit Oct 13 '15 at 12:21
  • 1
    You need to fulfill some requirements to submit for review. check for requirements it shows. – Salman Aslam Oct 13 '15 at 12:47
  • 1
    "https://developers.facebook.com/apps/{app-id}/review-status/items-in-review/" and check the section with red color warning sign. – Salman Aslam Oct 13 '15 at 12:58

0 Answers0