问题描述
我最近一直在开发一些Facebook应用程序,并且我总是遇到同样的问题:我找不到一种在iFrame Facebook应用程序上使用POST方法发送表单的方法。返回的 $ _ POST
始终为空。 我发现一个补丁是使用表单发送我的数据GET方法,并将其发送到画布页脚本URL,如下所示:< form action =<?php echo CANVAS_PAGE;?> script.phpmethod =GET>
,然后通过 $ _ REQUEST
获取我的数据。
我尝试使用POST / GET方法与 CANVAS_PAGE / script.php
/ CANVAS_URL / script.php
/ script.php
动作,这只是实际工作的东西。至少对我来说
现在,我遇到的问题是我需要上传一个文件,然后我必须使用POST方法,然后回到最初的问题 - >我找不到一种使用POST方法发送表单的方法。任何人都有答案?
发现答案。
只要你通过了Facebook的post方法, $ _REQUEST [signed_request]作为您表单中的signed_request的隐藏字段。
I've been developing some Facebook apps lately and I always had the same problem: I can't find a way to send a form with a POST method on iFrame Facebook apps. The returned $_POST
is always empty.
One patch I found is to send my data using a form using a GET method and to send it to the canvas page script URL, just like this: <form action="<?php echo CANVAS_PAGE; ?>script.php" method="GET" >
and then to get my data through $_REQUEST
.I tried any combination of POST /GET method with CANVAS_PAGE/script.php
/ CANVAS_URL/script.php
/ script.php
action and this is only thing that actually works. AT least for me.
Now, the problem I have is that I need to upload a file and then I must use the POST method and then back to the initial problem -> I can't find a way to send a form with a POST method. The returned $_POST
is always empty!!
Anybody has an answer to that?
Answer found.
The post method in Facebook works fine as long as you pass the $_REQUEST["signed_request"] as a hidden field called "signed_request" in your form.
这篇关于Facebook PHP表单返回空$ _POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!