Hello pleassse help am using httpservice in flash builder 4 for a login system, but am getting the result as raw php unprocessed data from server, but when i run the same file in the browser i get a correct xml file am using MAMP, PLEASE HELP donno what's the problem here is the php code :
<?php
define( "DATABASE_SERVER", "localhost:8888" );
define( "DATABASE_USERNAME", "root" );
define( "DATABASE_PASSWORD", "root" );
define( "DATABASE_NAME", "touch" );
//connect to the database
$mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die(mysql_error());
//select the database
mysql_select_db( DATABASE_NAME );
//These are the variables that Flex is passing to PHP
$username = mysql_real_escape_string($_POST["username"]);
$password = mysql_real_escape_string($_POST["password"]);
$logincookie = mysql_real_escape_string($_POST["logincookie"]);
//Check the credentials
$query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
$result = mysql_fetch_array(mysql_query($query));
//Output the returned query in XML: If returned false output 0 else output the users id
$output = "<?xml version='1.0' encoding='utf-8'?>";
$output .= "<loginsuccess>";
if(!$result)
{
$output .= $username;
}else{
$output .= $username;
}
$output .= "</loginsuccess>";
//Output the User Type
$usrtyp .= "<usertype>";
$usrtyp .= $result['user_type'];
$usrtyp .= "</usertype>";
//output all the XML
print ($output);
print ($usrtyp);
?>
and here is the request :
<s:HTTPService id="login_user" result="checkLogin(event)" showBusyCursor="true" method="POST"
url="login.php" useProxy="false">
<s:request xmlns="">
<username>
{username.text}
</username>
<password>
{password.text}
</password>
</s:request>
</s:HTTPService>
I'm going with a wild guess that you're not running this off of an HTTP server, but just referencing to the html/swf file itself on your filesystem, hence the PHP is not being processed.