简体   繁体   中英

PHP SDK, login - go to url and post to wall

I made an app that will allow users to upload one photo/video from localhost (exhibition) to their own wall.

now what I am trying to do is to get the FB login page and after a successful login to redirect to a "please wait..." page that will run the upload code in background. otherwise the user has to wait after logging in without knowing whats happening.

i tried the

"next" => "myurl",

but it doesnt work.

i am using php sdk.

do you have any ideas / references?

Edit:

My code for login dialog:

$login_url = $facebook->getLoginUrl( array( 'scope' => 'photo_upload, publish_stream, share_item', 'next' => 'http://www.google.com') );

header ("Location: $login_url");

I want to redirect this to a preloader html page and then upload using the normal upload code found in my upload.php

Try setting the redirect_uri like this:

$facebook->getLoginUrl(array(
    'scope'        => 'photo_upload, publish_stream, share_item',
    'redirect_uri' => 'http://your.preloadpage'
));

here is an example

$login_url = $facebook->getLoginUrl(array(
'scope' => 'photo_upload, publish_stream, share_item',
'fbconnect' => 1,
'canvas' => 0,
'next' => 'http://localhost/demo/facebook/index.php',
'redirect_uri' => 'http://localhost/demo/facebook/index.php',
));

param "next" indicates the url to be redirected after clicking a "finish"

param "redirect_uri" indicates the url to be redirected after the progressing to the next page.

and the hosts of redirect_uri and next are ought to be yours ,set and added in the facebook app settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM