Facebook iframe-如何发送表单(POST方法)


Facebook iframe - how to send form (POST method)?

我有一个非常简单的表单(文件名为message.php):

<?php
  print_r($_POST);
?>
<form method="post" target="_top" action="<?php echo CANVAS_URL;?>message.php">
  <input type="text" name="your_name" />
  <input type="hidden" name="signed_request" value="<?php echo $_REQUEST['signed_request'];?>" />
  <input type="submit" name="send" />
</form>

我找到了这个问题的一个解决方案——用signed_request将隐藏输入放入表单——我做到了,但不幸的是,我仍然面临这个问题——我无法检索发送的POST数据。

如果我将方法更改为method="get",那么一切都很好,但我需要从POST中获取数据。

有人能帮我吗,如何解决这个问题?谢谢

试试这个。我认为您不再需要在FB画布aps中使用target。此外,表格ID也很好。

<form method="POST" id="my_form" action="message.php">
    <input type="text" name="your_name" />
    <input type="hidden" value="<?php print $_POST["signed_request"] ?>" name="signed_request" />
    <input type="submit" name="submit" />
</form>

粘贴到Canvas URL(如http://apps.facebook.com/namespace)根本不支持。但是为什么要发布到顶部窗口,而不是简单地呆在iframe中呢?它更好,因为它不需要重新加载整个页面,只需要重新加载iframe。