“锻造” (= 模拟)AMFPHP 远程处理请求
我使用 AMFPHP 非常成功地将我的数据库与我的 Flex 应用程序链接起来。但是,我希望能够通过键入以下内容来测试闪存之外的远程处理请求:
http:// /localhost/amfphp/gateway.php?[我在此处放置什么]
为了让浏览器(或 C++ http 组件)调用 amfphp 服务,在问号后面放置什么,以便 http 请求不需要从闪存“启动”。
I am using AMFPHP with great success to link my database with my Flex application. However I want to be able to test the remoting requests outside of flash, by typing something like:
http://localhost/amfphp/gateway.php?[WHAT DO I PUT HERE]
What do I put after the questionmark in order to have the browser (or a C++ http component) call the amfphp service, so that the http request needn't "initiate" from flash.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
听起来您想从 PHP 进行 AMF 调用。您无法直接从浏览器执行此操作。数据将以二进制 AMF 格式返回,当然 PHP 或浏览器无法直接处理。我什至认为它不能提出要求。
您需要一个 AMF 客户端来进行调用并解码数据 - 我建议使用 SabreAMF。
Sabre AMF 主页
这是简单的客户端方法调用代码的样子。
然后你像这样调用它
,它会返回一个数组。
当然,您可能希望使用所有方法设置一个 PHP 类,以便可以轻松调用每个方法。
It sounds like you want to make an AMF call from PHP. You can't do this directly from a browser. The data would be returned in the binary AMF format, which of course PHP or a browser can't handle directly. I don't even think it can make the request.
You'll need a AMF client to make the call and decode the data - I suggest using SabreAMF.
Sabre AMF homepage
This is what simple client method call code looks like.
you then invoke this like
and it returns an array.
You'd probably want to set up a PHP class with all of your methods so you can call each one easily, of course.
AMFPHP 具有服务浏览器,它可以让您模拟对服务器端服务的调用并查看的回应。它基本上会向同一个服务文件发出内部 CURL 请求,并传入您提供的参数,并且就像直接从客户端 Flash 应用程序完成一样。
AMFPHP has the service browser, which lets you simulate calls to your server-side service and see the responses. It basically does an internal CURL request back to the same service file and passes in the arguments you provided, and acts as if it was done directly from the client-side Flash app.
AMF 是一种二进制格式,事情可能不会那么简单:你会找出你的数据是如何编码的...
作为第一步,也许你可以从你的 gateway.php 脚本中,在从 flash 组件调用它时将它接收到的所有内容转储到文件中?
这样,您就可以看到接收到的数据的样子(并且您会知道它是通过 POST 还是通过 GET 传递)。
根据数据的样子,也许您能够“伪造”到您的服务器的请求 - 但我认为这不会像从浏览器调用 URL 那样简单......
AMF being a binary format, things are probably not going to be that simple : you'll have to find out how your data is encoded...
As a first step, maybe you could, from your
gateway.php
script, just dump everything it receives to a file, when it's called from your flash component ?This way, you could see how the received data looks like (and you'd know if it's passed in POST, or in GET).
Depending on what that data looks like, maybe you'll be able to "forge" a request to your server -- but I don't think it'll be as simple as just calling an URL from your browser...
考虑到 AMFPHP 网关只是一种转换(从/到二进制)并分派到具有各种传入参数以及最终数据 return() 的类/方法的机制 - 您是否可以直接针对该方法进行单元测试,从而跳过整个 AMF 层?
Considering the AMFPHP gateway is just a mechanism to translate (from/to binary) and dispatch to a class/method with various incoming parameters and finally a return() of data - can you just unit-test directly against the method, thus skipping the entire AMF layer?