4 Replies Latest reply on Jun 5, 2008 10:07 PM by Jovin49

    Regarding Accessing HTTP

      I copied the below program from help content of adobe (For accessing http service-flex builder).The program will call a http service and receive the data and display it in a datagrid. The problem is the output data is not getting displayed in the datagrid. Not sure why is it so. This is a program in help part of adobe. I created the table, inserted the data as mentioned in the help. I tested the php weblink( http://localhost:8080/testuser.php) in the IE separately and it is working.

      Pasted the programs below
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      xmlns="*" creationComplete="send_data()">
      private function send_data():void {
      <mx:Form x="22" y="10" width="493">
      <mx:Label text="Username"/>
      <mx:TextInput id="username"/>
      <mx:Label text="Email Address"/>
      <mx:TextInput id="emailaddress"/>
      <mx:Button label="Submit" click="send_data()"/>
      <mx:DataGrid id="dgUserRequest" x="22" y="128" dataProvider="{userRequest.lastResult.users.user}">
      <mx:DataGridColumn headerText="User ID" dataField="userid"/>
      <mx:DataGridColumn headerText="User Name" dataField="username"/>


      <mx:TextInput x="22" y="292" id="selectedemailaddress"
      <mx:HTTPService id="userRequest" url=" http://localhost:8080/testuser.php" useProxy="false" method="POST">
      <mx:request xmlns="">

      PHP Program

      <title>PHP Test</title>
      define( "DATABASE_SERVER", "localhost" );
      define( "DATABASE_USERNAME", "root" );
      define( "DATABASE_PASSWORD", "admin123" );
      define( "DATABASE_NAME", "rssDB" );

      //connect to the database.

      mysql_select_db( DATABASE_NAME );

      // Quote variable to make safe
      function quote_smart($value)
      // Stripslashes
      if (get_magic_quotes_gpc()) {
      $value = stripslashes($value);
      // Quote if not integer
      if (!is_numeric($value)) {
      $value = "'" . mysql_real_escape_string($value) . "'";
      return $value;
      if( $_POST["emailaddress"] AND $_POST["username"])
      //add the user
      $Query = sprintf("INSERT INTO users VALUES ('', %s, %s)", quote_smart($_POST['username']), quote_smart($_POST['emailaddress']));

      $Result = mysql_query( $Query );
      //return a list of all the users
      $Query = "SELECT * from users";
      $Result = mysql_query( $Query );

      $Return = "<users>";

      while ( $User = mysql_fetch_object( $Result ) )
      $Return .= "<user><userid>".$User->userid."</userid><username>".$User->username."</username><emailad dress>".$User->emailaddress."</emailaddress></user>";
      $Return .= "</users>";
      mysql_free_result( $Result );
      print ($Return)