我正在向 php 脚本发送两个参数。如果我使用浏览器运行脚本并将参数传递给它,那么 php 脚本可以正常工作,例如http://www.somewebsite.com/runScript.php?id=aaa&name=bbb。但是当我使用 Flex httpservice 时,参数并没有传递给脚本。
<s:HTTPService url="http://www.somewebsite.com/runScript.php"
id="verifyUserService"
result="verifyUserResult(event)"
fault="verifyUserFault(event)"
method="GET"
contentType="application/xml"
useProxy="false">
<mx:request xmlns="">
<id>
{userId}
</id>
<name>
{username}
</name>
</mx:request>
</s:HTTPService>
我检查了网络监视器并正在发送参数:
POST /runScript.php HTTP/1.1 引用:app:/AIMTSJC.swf 接受:text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8, text/ css, image/png, image/jpeg, image/gif;q=0.8, application/x-shockwave-flash, video/mp4;q=0.9, flv-application/octet-stream;q=0.8, video/x- flv;q=0.7, audio/mp4, application/futuresplash, / ;q=0.5 x-flash-version: 10,1,53,64 Content-Type: application/xml Content-Length: 33 User-Agent: Mozilla/ 5.0(Windows;U;en-US)AppleWebKit/531.9(KHTML,如 Gecko)AdobeAIR/2.0.2 主机:www.somewebsite.com
aaabbb
返回响应:
HTTP/1.1 200 OK 日期:2010 年 9 月 2 日星期四 02:58:54 GMT 服务器:Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7d PHP/5.2.8 X-Powered-By: PHP /5.2.10 过期:1981 年 11 月 19 日星期四 08:52:00 GMT 缓存控制:无存储,无缓存,必须重新验证,后检查 = 0,预检查 = 0 编译指示:无缓存设置-Cookie:PHPSESSID=pa81b900ddff7c0b61c44c3380g3590fb;path=/ Transfer-Encoding: chunked Content-Type: text/html
身份证:姓名:
我的php脚本:
// Get the id and name.
$uid= $_GET["id"];
$uname= $_GET["name"];
echo "uid: ".$uid;
echo "uname: ".$uname;
我形成一个查询并发送到数据库。当我在浏览器 URL 上键入上面提到的 http://... 时,查询成功。uid 和 uname 都得到了正确的参数。但是我运行httpservice的时候,uid和uname都没有参数,查询失败。
任何帮助表示赞赏!
在此先感谢, aobs