【问题标题】:Facebook iframe - how to send form (POST method)?Facebook iframe - 如何发送表单(POST 方法)?
【发布时间】:2012-09-01 15:47:59
【问题描述】:

我的表格很简单(文件名为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 获取数据。

谁能帮助我,如何解决这个问题?谢谢!

【问题讨论】:

    标签: php facebook facebook-graph-api facebook-iframe


    【解决方案1】:

    试试这个。我认为您不再需要在 FB 画布应用程序中使用 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>
    

    【讨论】:

    • 感谢您的回复,但不幸的是,这对我没有帮助。仍然无法从 $_POST 检索数据
    • 嗯。唯一不同的是我没有在文件名前面使用&lt;?php echo CANVAS_URL;?&gt;。如果此代码在 message.php 中,那么为什么它需要在那里?除此之外,也许您可​​以发布更多代码或链接到一个实时示例?
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-05
      • 1970-01-01
      • 2015-08-04
      相关资源
      最近更新 更多