Loading ...
Sorry, an error occurred while loading the content.

LWP not following redirect.

Expand Messages
  • Franki
    Hello peoples... I have a small issue with the LWP modules... I have a script that is supposed to go and collect a page using LWP, it works... When that same
    Message 1 of 3 , Oct 1, 2002
    • 0 Attachment
      Hello peoples...

      I have a small issue with the LWP modules...


      I have a script that is supposed to go and collect a page using LWP, it
      works...

      When that same script is pointed to a perl script that displays HTML.. that
      works too...


      However, when that perl script prints a location redirect header, LWP seems
      to take that header as the content and displays a blank page...

      So my question is this.. .is it possible to tell LWP to follow the redirect
      and collect the HTML of the resulatant location??
      (which is in this case a PHP script...)


      In other words, I am hoping there is some parameter to LWP that I can set
      that will tell it to behave more like a browser and follow the location
      header...


      if anyone knows anything about this, I'd dearly love to hear it..

      I am looking through the LWP docs as we speak, but nothing I can find seems
      to detail this...


      many thanks


      rgds


      Frank
    • Louis Fechter
      Hi Guys, I have a database with a perl query script. I have an HTML file which contains the following. the
      Message 2 of 3 , Oct 1, 2002
      • 0 Attachment
        Hi Guys,

        I have a database with a perl query script.

        I have an HTML file which contains the following.
        <!--#exec cgi="cgi-bin/prices.pl?code=000003" -->

        the perl scrip looks like this.

        #! c:/perl -w
        use CGI;
        use DBI;


        $input=new CGI;
        $code=$input->param('code'); #product code
        #---
        $dbh=DBI->connect('DBI:mysql:furniture') || die 'ERR: connect';

        $query="SELECT price FROM benches WHERE code=?";
        print "$code <--";
        print $query;
        $sth=$dbh->prepare($query);
        $sth->execute($code);
        #---
        print "hello";
        print $sth->dump_results;
        $dbh->disconnect;
        #---
        exit 0;

        the database has stock codes and also has prices linked to the stock
        codes. Im trying to get it to print the price from knowing the stock
        code... can anyone tell me what could be wrong with the perl script ?

        It was working in offline mode - IF I entered 000003 as the stock code -
        it returned the correct price. But when running it thru the HTML page
        with the #exec it returned "0 rows"

        Help would be much appreciated. Thanks :)

        Louis
      Your message has been successfully submitted and would be delivered to recipients shortly.