Solved

Parse XML from Flash in Perl

Posted on 2007-03-28
6
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The goal of the tutorial is to teach the user how to how to record live broadcast.

710 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