[as3.0] URLRequest send XML to server

Hi there.

I have XML object formed and data ready to write to the server by means of server-side script. The code used on the server-side script is testing code available from the ActionScript 3.0 cookbook examples (by Joey Lott).

It basically takes the XML object, parses it and writes some of the text node values into a textfile.

What i want to achieve
send the xml data from AS3.0 to PHP/PERL script, parse these data, write some variables from the xml object into a textfile on the server.

However
In case of PHP version of the server-side script:


<?php

........
     
// Read root element <gameinfo>.
$rootElement = $document->root(  );

// Read child nodes <username> and <score>.
$childNodes = $rootElement->children(  );
     
$data = "";
     
// Loop through child nodes and place in array.
foreach($childNodes as $childNode){
  // Add data to array;
  $name = $childNode->tagName(  ); //  [COLOR=DarkGreen]**
[*]** [/COLOR]HERE THE ERROR OCCURS

  ............

}
     
// Append data to textfile on the server
........
     
// Return success code to Flash
......
?>

after the response from the script arrives, i get TypeError in AS3.0, since there is try/catch error filtering happening:


try {
      // parse **event.target.data**

      } catch ( e:TypeError ) {
        // trace the error
        [COLOR=Red][COLOR=Black]**_message.text = "returned: " **+[/COLOR]** event.target.data;**[/COLOR]
      }

When i trace the event.target.data of the event object i get:


**[COLOR=Red]Fatal error:  Call to undefined function:  tagname() in /data/web/flashprojects.sk/web/new/xml_test/php/gamescores.php on line 21[/COLOR]**

(see [COLOR=DarkGreen]**
[*]**[/COLOR] inside PHP script); now sure that exaplins why there is TypeError (or SyntaxError) recognized by flash :stuck_out_tongue:

Is my php5 on the server not enough? Why does it not seem to understand the $name = $childNode->tagName( ); syntax?

No matter, there is still perl script example, which does the same thing as the PHP example, and perl is supported by the server where my example is hosted… so i try that one…

However, using the perl counterpart i get this error in AS3.0:


[COLOR=Red]**Error #2044: Unhandled ioError:. text=Error #2032: Stream Error.**[/COLOR]

Although the script file was found, it seems cgi is not enabled on my server or… ? (i check my server settings, and cgi is enabled, supported perl filetypes are .cgi, .pl)

Anybody met these errors / found a solution?
Thank You :slight_smile: