Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7061627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:29:50+00:00 2026-05-28T04:29:50+00:00

I have a Facebook PHP SDK APP in development phase and i’m stuck on

  • 0

I have a Facebook PHP SDK APP in development phase and i’m stuck on something…
The logic of the APP is this:

first the user have to like the page (app is on this) // works very well 🙂
after that comes the permissions request
if permission is granted: the app_data variable is pass through and the user recieves a picture.

app_data variable is necessary because, if the user clicks the app after permission granted again, it gets new picture automaticly. with the app_data don’t.

my problem is this link:

    $params = array(
  scope => 'publish_stream,user_photos',
  redirect_uri => 'http://www.facebook.com/XXXXX?sk=app_YYYYYY&app_data=1'
    );

<a href="<?php echo $facebook->getLoginUrl($params); ?>">Accept</a>

If i click on it, the app shows blank page, and nothing happening… 🙁
On direct call, that app runs without any error.

Can someone help me out?

// sorry for my english…

Thank you!

and the whole index.php is:

this is the whole index.php:

<?php
require 'facebook.php';

$facebook = new Facebook(array(
'appId' => 'xxxxx',
'secret' => 'yyyyy',
'baseUrl' => 'http://hosting.address/',
'appBaseUrl' => 'http://apps.facebook.com/app-name/',
'fileUpload' => 'true',
));
// Get User ID
$user = $facebook->getUser();

$params = array(
  scope => 'publish_stream,user_photos',
  redirect_uri => 'http://www.facebook.com/xxxxx?sk=app_yyyyy&app_data=1'
    );

$signed_request = $facebook->getSignedRequest();
$app_data = $signed_request["app_data"];


?>
                    <!doctype html>
                    <html xmlns:fb="http://www.facebook.com/2008/fbml">
                    <head>
                    <title>the title</title>
                    <style>
                        a:link    {color:#ffffff;}
                        a:visited {color:#ffffff;}
                        a:hover   {color:#ececec;}
                        a:active  {color:#1f1f1f;}
                        a:link    {text-decoration: none}
                    </style>
                    </head>
                    <body>
<?php if ($user){

    try {
        $user_profile = $facebook->api('/me');
        $likes = $facebook->api("/me/likes/123123123"); //page ID

            if( !empty($likes['data']) ){

                $scope = 'publish_stream,user_photos';
                $scope_params = explode(',',$scope);

                $permissions = $facebook->api("/me/permissions");
                    if( array_key_exists('publish_stream', $permissions['data'][0]) &&  array_key_exists('user_photos', $permissions['data'][0]) && isset($app_data)) {


                        $file = "1.jpg";
                        $message = 'bla bla';

                        $ret_obj = $facebook->api('/me/photos', 'POST', array(
                                                                        'source' => '@' . $file,
                                                                        'message' => $message,
                                                                    )
                                                                );
                        echo "<img width=\"520px\" src=\"1.jpg\" />";
                    } else {
                    ?>
<a href="<?php echo $facebook->getLoginUrl($params); ?>">accept</a></td>
<a href="http://www.facebook.com/pageurl">deny</a></td>

                    <?
                    }
            }else{
                echo "<img width=\"520px\" src=\"no-fan.jpg\" />";
            }

    } catch (FacebookApiException $e) {
        echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
        $user = null;
        }
    }

    if ($user) {
        } else {
            $loginUrl = $facebook->getLoginUrl($params);
            echo '<script type="text/javascript">top.location.href = "'.$loginUrl .'";</script>';
        }

        ?>

</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:29:51+00:00Added an answer on May 28, 2026 at 4:29 am

    I’ve had this before when I was delving into the world of Facebook apps.

    What I eventually done was for my redirect_uri I used a page on my domain, e.g. https://domain.com/facebook/redirect.php and in redirect.php I would have:

    // user didn't give app permissions
    if (isset($_GET['error_reason']))
    {
        header( 'Location: http://www.facebook.com/FANPAGE' ) ;
    }
    else 
    {
        header( 'Location: http://www.facebook.com/XXXXX?sk=app_YYYYYY' ) ;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I use Facebook PHP SDK to deauthorize my app for a particular user,
I am using Facebook PHP SDK to authenticate the user. After generating the LoginUrl
I am using Facebook PHP SDK 3.0 I would like to know how could
Our app uses the PHP- aswell as the JS-SDK of Facebook. We are able
I have an iframe Facebook application that uses the Facebook PHP SDK to authenticate
I am creating a facebook applicatioon using PHP-SDK and GRAPH-API. I feel like saving
I have Phonegap's Facebook plugin working perfectly within my Android app. This plugin uses
I have been using php-sdk to connect to facebook for a while and I
So I am using the facebook-php-sdk and I have created a page tab On
I have recently downloaded the Facebook PHP SDK to try and post to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.