简体   繁体   English

发布后的Facebook redirect_uri

[英]Facebook redirect_uri after post

I understand how to redirect a user after a logging in through facebook api, but how can I set the redirect destination for after a successful post. 我了解通过Facebook api登录后如何重定向用户,但发布成功后如何设置重定向目标。 This is how I am simultaeously posting to facebook and my blog at the same time. 这就是我同时发布到Facebook和我的博客的方式。

$post_url = '/'.$userPageId.'/links';

$msg_body = array(
  'message' => 'Hello World',
  'link' => 'http://localhost:8888/path/to/my/blog?blog='.$this->id,
);

$postResult = $facebook->api($post_url, 'post', $msg_body );

Currently, user will fill out the web form (new_blog.php) with the required blog fields, hit submit, and the blog will post to my websites database and also to facebook and then redirect back to new_blog.php. 当前,用户将使用必填的博客字段填写Web表单(new_blog.php),单击“提交”,该博客将发布到我的网站数据库以及Facebook,然后重定向回new_blog.php。 I need to redirect to a different page after successful post. 成功发布后,我需要重定向到其他页面。

All calls to the Facebook Graph API via the PHP SDK are synchronous . 通过PHP SDK对Facebook Graph API的所有调用都是同步的 Therefore you can call any function directly after the call to the API, eg: 因此,您可以在调用API之后直接调用任何函数,例如:

<?php
try 
{
    $result = $facebook->api($post_url, 'post', $msg_body);
    do_something($result);
} 
catch (Exception $e) 
{
  // Error
}
?>

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

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