Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I am using LWP::Simple to display an html page (actually asp) - this works fine in IE but on Netscape it just displays the source code!

this is the redirect code:

use LWP::Simple; my $content = get("http://www.photographersdirect.com/sellers/pe_selle +rredirect.asp?$ENV{'QUERY_STRING'}"); <code> if (defined $content) { #$content will contain the html associated with the url mentioned +above. print $content; }

and it displays code like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/T +R/html4/strict.dtd"> <html> <head> <title>PHOTOGRAPHERS DIRECT - Fair Trade Photography</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +"> <style type="text/css"> </head> <body> content </body> </html>

anyone know how to make it display the html properly rather than the source code?

Replies are listed 'Best First'.
Re: using LWP::Simple to display an html (asp) page
by tcf22 (Priest) on Aug 27, 2003 at 17:39 UTC
    I think you forgot the content-type. IE is more forgiving with this.
    use strict; use LWP::Simple; my $content = get("http://www.photographersdirect.com/sellers/pe_selle +rredirect.asp?$ENV{'QUERY_STRING'}"); print "Content-type: text/html\n\n$content" if (defined $content);
      Fantastic!

      it works

      I love it when a plan comes together

      thanks for your help!

      Chris