5 Replies Latest reply on Aug 23, 2009 7:03 AM by Augusto Esteves

    Help: Sending HTTPService request using POST to a php script


      Hello all,


      I need help in learning the proper method of communicating to php scripts from flex 3. I am very new to flex 3, php and web development. Thanks!


      What I am trying to do is as follows:

      1. User drags and drops a few items in a list control

      2. user clicks a button to send these keywords to server php script

      3. server will form a query based on the words sent and retrieve records and send them back


      Here is what I have done so far:

      1. When I send a request to server without any parameters, I amable to receive the request and query the database and send results in xml format


      current issues I am facing:

      1. I am gathering the list of entries in list control as follows:

      <*** this function is callled when user decides to send request to server ***>

      private function startsearch():void {
         var i:int;
         var myAC:ArrayCollection = ArrayCollection(SelCtypes_id.dataProvider);
         var nct:XML = new XML("<contenttypes></contenttypes>");
         // add contenttype child now
         for (i = 0; i<myAC.length; i++) {
         var params:Object = new Object();
         params.contenttypes = nct.toXMLString();


      <*** my http service entry****>

        <mx:HTTPService id="getsearchresults"
        contentType="application/xml" />

      This is what I see in flex debugger just when the request is sent out:

      -> just before gersearchresults.send(params) call:

      params.contenttypes = "<contenttypes>


      <*** within the HTTPrequest send function, I see th following in debugger ***>


      message.body = paramsToSend shows "






      This looks like my XML object is again formatted by an out <contenttypes> tag and the string is converted to be HTML safe (i.e. &lt, &gt notation).


      It looks like I am not doing something right with my params formation to XML and HTTPservice is reformatting it to be some form of XML (I do not know XML well either :-)


      My questions:


      1. What am I doing wrong?

      2. If there is a good example where I can send multiple parameters from flex client to php server and get data back where the request parameters will beof the form...













      Thanks for your help!