Solved

Parse XML from Flash in Perl

Posted on 2007-03-28
6
278 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now