0
在這個PHP頁面上,我正在解析從我正在使用的Facebook註冊插件接收到的已簽名請求。我保存的簽名請求$ response對象的位置屬性存在問題,但我無法弄清楚它是什麼。我得到了兩個錯誤之一:1. 地址不明白,firefox不知道如何打開地址,因爲協議沒有與任何程序關聯。當我得到這個錯誤時,瀏覽器欄顯示:s:18:「紐約,紐約」;這是我試圖保存到變量中的位置屬性的值。第二個錯誤:在此服務器上未找到請求的URL /~spilot/spilot.koding.com/website/New York,紐約。再次,「紐約紐約」,作爲我試圖保存到變量中的位置屬性的值。下面是我對整個PHP頁面代碼:不知道爲什麼我從我的PHP代碼獲取服務器錯誤
<?php
//code omitted here that decodes and checks the JSON signature of the signed request. It has been tested and I know the problem isn't there.
if ($_REQUEST)
{
$response = parse_signed_request($_REQUEST['signed_request'],
FACEBOOK_SECRET);
}
//this is where I save the values from the registration form into php variables.
$name = $response["registration"]["name"];
$email = $response["registration"]["email"];
$password = $response["registration"]["password"];
$uID = $response["user_id"];
// The problem is with the location variable.
//我想它來存儲到我的數據庫作爲一個字符串,而不是一個對象這就是爲什麼我使用//序列化(),但我得到了上述錯誤是否使用序列化。
$location = $response["registration"]["location"]["name"];
$city = serialize($location);
?>
// I'm using the Parse Cloud Server to power the back end and I have to connect with parse using javascript.
<script type="text/javascript">
var password = '<?php echo $password ?>';
var name = '<?php echo $name ?>';
var uID = '<?php echo $uID ?>';
var email = '<?php echo $email ?>';
var location = '<?php echo $city ?>';
//Initialize the Parse SDK!
Parse.initialize("ivHLAO7z9ml1bBglUNuPSgcWabXe3UeE********","gNeGt04lU7xcew8********qc4POVhBsIBSCVj");
var User = new Parse.User();
User.set("password", password);
User.set("username", name);
User.set("uID", uID);
User.set("email", email);
User.set("location", $city);
User.signUp(null, {
success: function(user)
{
alert("User signed up!");
}
});
</script>
天哪。有效。非常感謝。我不知道問題是什麼。你一直是一個巨大的幫助。 – Spilot