好吧,我已經設置了一個可以正常工作的應用程序,但有一個問題,當人們將標籤添加到他們的頁面時,他們去了顯示「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 }
?>
如何使用重定向到該頁面不屬於我graph.facebook.com/255826047791900/... * ** &方法=張貼 *
它仍然顯示該頁面,如果你知道任何其他編碼方式不會產生像這樣的問題,然後告訴我,我也會嘗試。 –
你試過 <?php echo(「」); ?> – Amila
是的,但它沒有幫助 –