I am trying to retrieve content from a dynamic XML generated in Perl proxy. here is the code,
$show=$query->param('id_show');
$lang=$query->param('id_lang');
$filename="http://thetvdb.com/api/GetSeries.php?seriesname=".$show."&language=".$lang;
print "$filename </br>";
print "End of Program";
# use module
use XML::Simple;
use Data::Dumper;
# create object
$xml = new XML::Simple;
# read XML file
$data = $xml->XMLin("$filename");
print "$data </br>";
Now the error which is being shown to me is :
File does not exist: http://thetvdb.com/api/GetSeries.php?seriesname=Fringe&language=English at /cgi-bin/mytest.pl line 37
I later on want to send this xml contents to javascript where JS will parse the contents and display.
Well, that’s because
XML::Simple::XMLin()method doesn’t work with HTTP links, I suppose. The only legit sources of data it might use are filenames, IO::Handle objects, and strings.Try to fetch the content of this link with
LWP::Simplemodule (it exports very convenient functionget()right for this case), like this:…then pass the resulting $content to the XMLin.