Solved

Parse XML from Flash in Perl

Posted on 2007-03-28
6
291 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
How To Reduce Deployment Times With Pre-Baked AMIs

Even if we can't include all the files in the base image, we can sometimes include some of the larger files that we would otherwise have to download, and we can also sometimes remove the most time-consuming steps. This can help a lot with reducing deployment times.

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
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 what frame rate is, how to control it and what effect it has on the video.

630 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