Solved

Parse XML from Flash in Perl

Posted on 2007-03-28
6
282 Views
Last Modified: 2010-04-03
I've been searching all over the net but can't find a tutorial the explains how to parse xml from flash using Perl.  I've found some stuff with PhP but i don't have the time to learn a new language just for this one goal.

Basically, I have a Flash program that records some data from the user, turns it into XML and sends it out to a perl program on my server.  I need the perl program to parse the incoming XML into variables and then store the data on the server.  I, however, do not know how to do the parsing part.  Any help would be much appreciated!

Jeff
0
Comment
Question by:jeffgalak
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 18809932
use XML::Simple;
use Data::Dumper;
my $ref = XMLin("/path/to/xml/file.xml");


print Dumper($ref);
0
 

Author Comment

by:jeffgalak
ID: 18810632
that looks find, but i'm not sure how Flash sends the data to the perl script.  So in flash i just use the command:

myXML.load("http://url/perlfile.pl")

This sends the xml data (in the variable myXML) to the per file.  How does the perl file then receive the XML data?
0
 
LVL 39

Expert Comment

by:Adam314
ID: 18811791
the myXML.load(url) is to get XML data from a file into flash.  Originally, it sounds as if you have XML data in flash, and want to get it to perl.

See here for more in the XML.load method:
http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary843.html
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:jeffgalak
ID: 18811865
That's my fault...i meant to type "myXML.send(url)"...so yes, i am trying to send FROM Flash to Perl
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 250 total points
ID: 18812464
According to documentation, that will send the data using POST.
To read the data, use the CGI module.  Then use the XML::Simple module to parse it.  Here is an example:

#!/usr/bin/perl
use CGI qw/:standard/;
use XML::Simple;
use Data::Dumper;

#Get all data
my $data = $query->param('POSTDATA');

#Parse into XML::Simple object
my $ref=XMLin($data);

#Display results:
print header(-type  =>  'text/plain');
print Dumper($ref);

0
 

Author Comment

by:jeffgalak
ID: 18812779
Thanks for all the help!!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question