简体   繁体   English

添加页面选项卡后重定向到另一个链接

[英]redirect to another link after page tab added

Okay so I've setup an app which works fine but there's one problem when people add tab to their pages they went to page which show "true" it means page is added successful but i want to redirect them to their page or any other link after page tab added successfully. 好的,所以我已经安装了一个运行良好的应用程序,但是当人们在页面上添加标签时出现一个问题,他们进入显示“ true”的页面,这意味着页面添加成功,但是我想将其重定向到他们的页面或任何其他链接页面选项卡添加成功后。

<?php
session_start();
$facebook=$_SESSION['facebook'];
include("facebook/src/facebook.php");
$facebook=new Facebook(array(
      'appId'  => '197786760292550',
      'secret' => 'e284332964b213066d3b247e1eb4b4a0',
    ));
    $user = $facebook->getUser();
    $access_token = $facebook->getAccessToken();
if ($user) {
      try {
        // Proceed knowing you have a logged in user who's authenticated.
        $user_profile = $facebook->api('/me');
      } catch (FacebookApiException $e) {
        error_log($e);
        $user = null;
      }
    }


//Login or logout url will be needed depending on current user state.

    if ($user) { 

    if(isset($_POST['page']))
    {
    $page=$_POST['page'];
    $explodepage=explode("with",$page);
    $acctoken=$explodepage[1];
    $pgid=$explodepage[0];
    $url="https://graph.facebook.com/".$pgid."/tabs?app_id=197786760292550&access_token=".$acctoken."&method=post";
    ?>
    <script>
window.top.location="<?php echo $url?>";
</script>
    <?php }
    $url="https://graph.facebook.com/".$user."/accounts?access_token=".$access_token;
    $ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: graph.facebook.com'));
$output = curl_exec($ch);
curl_close($ch); 
$input=json_decode($output);
$data=$input->data;
$count=count($data)-1; 
?> <form action="" method="post">
<?php for($x=1; $x<=$count; $x++)
{
    $pdata[$x]=$data[$x];
    $pname[$x]=$pdata[$x]->name;
    $ptoken[$x]=$pdata[$x]->access_token;
    $pid[$x]=$pdata[$x]->id; ?>
    <img src="https://graph.facebook.com/<?php echo $pid[$x]; ?>/picture"/>
    <?php echo $pname[$x]."<input type='radio' name='page' value='".$pid[$x]."with".$ptoken[$x]."' /><br>";
} echo "<input type='submit' name='submit'></form>"; } else {
     $app=197786760292550;
$appsecret="e284332964b213066d3b247e1eb4b4a0";
$url="http://www.facebook.com/dialog/oauth?";
$redirect="http://luutaa.co.in/fb_close/access_token.php";
$scope="manage_pages,publish_stream";
$x=$url."client_id=".$app."&redirect_uri=".$redirect."&scope=".$scope;
?>
<script>
window.top.location = "<?php echo $x?>";
</script>
   <?php }
?>

How can i use redirect to this page which is not mine graph.facebook.com/255826047791900/… * ** 如何使用重定向到该页面不属于我graph.facebook.com/255826047791900/... * ** &method=post * &method =发布 *

尝试这个

echo("<script> top.location.href='" . $x . "'</script>");

Why don't you use 'header'? 为什么不使用“标题”?

<?php
header('Location: '.$url);
?>

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

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