POST 请求不正确?
我试图通过 Flex 中的 POST 请求加载 xml:
var request:URLRequest = new URLRequest('res/unhasher.xml');
request.method = URLRequestMethod.POST;
loader = new URLLoader();
loader.load(request);
但在 Firebug 中我看到我的文件是通过 GET 加载的。
请求标头:
GET res/unhasher.xml HTTP/1.1
Host: bla-bla-bla.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
我做错了什么?如何从 Flash/Flex 发出 POST 请求?
I'm trying to load an xml via POST-request in Flex:
var request:URLRequest = new URLRequest('res/unhasher.xml');
request.method = URLRequestMethod.POST;
loader = new URLLoader();
loader.load(request);
But in Firebug I see that my file is loaded through GET.
Request header:
GET res/unhasher.xml HTTP/1.1
Host: bla-bla-bla.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
What am I doing wrong? How to make POST requests from Flash/Flex?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您实际上并没有发布任何数据,因此 Flash 可能会执行 GET 操作。尝试添加一些测试数据看看是否有效:
You are not actually posting any data, so maybe Flash do a GET instead. Try adding some test data to see if it works:
将您的 swf 放在本地/远程服务器中,它应该发送 POST 请求。据我所知,Flash 从本地文件系统发送 GET(当您通过
file://
在浏览器中打开 html/swf 或从 IDE 中打开 html/swf 时)Put your swf in a local/remote server and it should send a POST request. As far as I know, Flash sends GET from local filesystem (either when you open html/swf in a browser via
file://
or from the IDE)