简体   繁体   English

PHP SDK,登录-转到url并发布到墙上

[英]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. 现在,我要执行的操作是获取FB登录页面,并在成功登录后重定向到“请稍候...”页面,该页面将在后台运行上传代码。 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. 我正在使用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 我想将其重定向到preloader html页面,然后使用在upload.php中找到的正常上传代码上传

Try setting the redirect_uri like this: 尝试这样设置redirect_uri:

$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. 参数“ redirect_uri”表示进入下一页后要重定向的URL。

and the hosts of redirect_uri and next are ought to be yours ,set and added in the facebook app settings. redirect_urinext的主机应该是您自己的,设置并添加到facebook应用程序设置中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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