A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Help with XML and PHP using 3DFA ?!?

  1. #1
    The Flash Man !
    Join Date
    Jan 2007
    Location
    San Francisco, CA
    Posts
    21

    Help with XML and PHP using 3DFA ?!?

    I have been trying to use the following function :

    _xmlDoc.send ("url-goes-here");

    To transmit an XML doc from a 3DFA Flash to a PHP server.

    I have tried every variation of this I can think of and still I cannot tell which PHP variable has the XML Document once the server responds to handle the request.

    I can see the $_SERVER scope using PHP to see that the Request is a POST but none of the following variables seem to have the XML Doc that was supposed to be sent to the server: $HTTP_POST_VARS, $HTTP_RAW_POST_DATA, $_POST.

    The docs for 3DFA are quite sparse and terse where this function is concerned so I have no idea how to retrieve the data using PHP once the XML Doc has been sent to the server.

    I could work around this by using the xmlDoc.toString() function to make the XML Doc into a chunk of text I can send to the server using loadvars() but doing that seems silly seeing how I want the whole XML Doc to be sent to the server using a single function call.

    What am I missing here ?

    Thanks for whatever help anyone might give me.
    www.ez-ajax.com OR flash.ez-ajax.com I live to code !

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    You try looking in the XML forum.

    I found this on another site
    Code:
    <?PHP
    $xmlToWrite = $HTTP_RAW_POST_DATA;
    $fp = fopen("output.xml","w");
    rewind($fp);
    fwrite($fp,$xmlToWrite);
    fclose($fp);
    
    $xmlToSend = $xmlToWrite;
    print $xmlToSend;
    exit;
    ?>

  3. #3
    Junior Member
    Join Date
    Mar 2007
    Posts
    5

    3dfa with xml

    how can i read the xml using 3dfa ?

    ive tried some scripts like: var RsXml :XML = new XML()....
    its returning error..
    why?

  4. #4
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    Quote Originally Posted by pdr33n
    how can i read the xml using 3dfa ?

    ive tried some scripts like: var RsXml :XML = new XML()....
    its returning error..
    why?
    Help file helps, there is section about handling XML files

  5. #5
    Junior Member
    Join Date
    Mar 2007
    Posts
    5
    thanks..
    ive found but why the commands are different from the flash 8 ?

  6. #6
    Senior Member
    Join Date
    Dec 2006
    Posts
    274
    3dfa uses "javascript" syntax.. Actionscript syntax is bit different. And why javascript,. is it licensing issue, I dunno?!

  7. #7
    Junior Member
    Join Date
    Mar 2007
    Posts
    5
    humm... thanks.. i got it.


  8. #8
    Junior Member
    Join Date
    Mar 2007
    Posts
    5

    problem

    i put it on ADD NEW ELEMENT - SCRIPT
    its returning the value, name.. ok.
    now, how can i show it in a box or something like that?
    whats the element to use? html text?

  9. #9
    The Flash Man !
    Join Date
    Jan 2007
    Location
    San Francisco, CA
    Posts
    21

    You have all managed to miss my original point...

    The problem I ran into was that 3DFA did not seem to transmit the XML to the PHP server at all.

    I have successfully used Flash based languages that can and do transmit objects to a PHP server so let's not think I have no idea as to what I am trying to do with 3DFA in this instance.

    I checked every single CGI variable using PHP that I could think of to see where the data was I was trying to send to the PHP server and "no-joy".

    I would expect the XML to be packaged into some kind of POST operation once PHP gets control of the data flow but this was not the case.

    What am I missing here folks ? There is very little documentation as to what 3DFA does when sending XML to a server.

    Flex Builder 2 on the other hand has quite a lot of documentation and I was able to make REST work to my heart's content with no problems.
    www.ez-ajax.com OR flash.ez-ajax.com I live to code !

  10. #10
    Junior Member
    Join Date
    Mar 2007
    Posts
    5
    hmm.. im gonna download Flex to see.. but im trying to read a XML (made with php) to show the content on swf.

    ive heard that i have to do something with the html text.. do you know how to do this?

  11. #11
    The Flash Man !
    Join Date
    Jan 2007
    Location
    San Francisco, CA
    Posts
    21
    Quote Originally Posted by pdr33n
    hmm.. im gonna download Flex to see.. but im trying to read a XML (made with php) to show the content on swf.

    ive heard that i have to do something with the html text.. do you know how to do this?
    You can consume XML using Flex very easily.

    You will want to make a REST Web Service - relax REST is what you have been doing your whole life, assuming you know how to code PHP.

    $xml = "";
    $xml .= '<data id="0">';
    $xml .= '<node>1</node>';
    $xml .= '<node>2</node>';
    $xml .= '</data>';
    echo $xml;

    Above is all the code in PHP it takes to emit usable XML that can be consumed by Flex.

    The Flex code is a bit more than this but not too complex.

    The nice thing about Flex is the many ways Flex can be made to interpret XML. Flex can make XML into an Object or an ArrayCollection or a number of other usable objects.

    If you get hung up on the Flex code let me know and I can give you a hand.
    www.ez-ajax.com OR flash.ez-ajax.com I live to code !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center