I am sending two parameters to a php script. The php script works fine if I use the browser to run the script and pass parameters to it like http://www.somewebsite.com/runScript.php?id=aaa&name=bbb. But when I use the Flex httpservice, the parameters are not passed to the script.
<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>
I checked the Network Monitor and the parameters are being sent:
POST /runScript.php HTTP/1.1 Referer: app:/AIMTSJC.swf Accept: 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, like Gecko) AdobeAIR/2.0.2 Host: www.somewebsite.com
aaabbb
Returned response:
HTTP/1.1 200 OK Date: Thu, 02 Sep 2010 02:58:54 GMT Server: 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 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: PHPSESSID=pa81b900ddff7c0b61c44c3380g3590fb; path=/ Transfer-Encoding: chunked Content-Type: text/html
id: name:
My php script:
// Get the id and name.
$uid= $_GET["id"];
$uname= $_GET["name"];
echo "uid: ".$uid;
echo "uname: ".$uname;
I form a query and send to the database. The query is successful when I type the http://... as mentioned above on the browser URL. Both the uid and uname got the correct parameters. But when I run the httpservice, both uid and uname has no parameters, and the query fails.
Any help is appreciated!
Thanks in advance, aobs