我有一个脚本,可以验证用户是否在Twitter上关注了另一个用户。这是在我的网站上点击按钮弹出一个窗口,提示用户在其推特页面上关注其他用户。
在他们这样做之后,他们想在我的网站上点击确认。然后我的代码检查用户是否这样做并确认成功或出现错误。
我已经对此进行了测试,无论我关注Twitter用户多少次,它总是会出现我没有的错误。我认为这与javascript代码的这一部分有关。
function followuser(str,user,name)
{
document.getElementById("Hint").style.display='block';
$("#Hint").html('Verifiziere@'+name+'...');
$.ajax({
type: "POST",
url: "plugins/tw/complete.php",
data: "me="+str+"&him="+user,
success: function(msg){
$("#Hint").html(msg);
var coins = $("#coins").html().replace(" Coins", "");
coins = parseInt(coins) + parseInt($("#" + user + "points").html().replace("Coins: <b>","").replace("</b>",""));
$("#coins").html(coins + " Coins");
removeElement('boxes', user);
}
});
}
在complete.php文件中
$url = "http://api.twitter.com/1/friendships/exists.json?screen_name_a=" . $data3->twitter . "&screen_name_b=".$id;
$page = get_data($url);
$json_a = json_decode($page,true);
在if语句中,$ page总是出错。