Reading html into a source file

Discussion in 'Perl Misc' started by Chris, Feb 13, 2004.

  1. Chris

    Chris Guest

    Apologies for the mail but this is driving me crazy. I'm trying to
    read an external html file into an array and then check for a sub
    string in the array. The only problem is that the html file is not
    getting loaded into either the array or a text file. I have tried the
    following:

    #!/usr/local/bin/perl
    print "Content-Type: text/plain\n\n";
    use LWP::Simple;
    $content = get ("http://www.webbuyeruk.co.uk/index.htm");
    print " This is Content:\n\n $content \n\n";
    exit;

    (above as seen in google postings) but no contents appear on my
    screen? Any help appreciated! I'm using perl 5.8 on windows 2K.

    Regards,

    Chris.
     
    Chris, Feb 13, 2004
    #1
    1. Advertising

  2. Chris wrote:

    > #!/usr/local/bin/perl

    Unix shebang line

    >I'm using perl 5.8 on windows 2K.


    Windows operating system??

    gtoomey
     
    Gregory Toomey, Feb 13, 2004
    #2
    1. Advertising

  3. (Chris) wrote:

    > Apologies for the mail but this is driving me crazy. I'm trying to
    > read an external html file into an array and then check for a sub
    > string in the array. The only problem is that the html file is not
    > getting loaded into either the array or a text file. I have tried the
    > following:
    >
    > #!/usr/local/bin/perl


    If you're running this as CGI under Apache this might be a problem. Apache
    actually uses the #! line. perl.exe will process any switches on the #!
    line but will otherwise ignore it IIRC.

    > print "Content-Type: text/plain\n\n";
    > use LWP::Simple;
    > $content = get ("http://www.webbuyeruk.co.uk/index.htm");
    > print " This is Content:\n\n $content \n\n";
    > exit;
    >
    > (above as seen in google postings) but no contents appear on my
    > screen? Any help appreciated! I'm using perl 5.8 on windows 2K.


    Runs fine for me at the command line under Windows XP Pro. It's not your
    program, so it must be something with your web server, i.e; not a Perl
    problem.

    --
    David Wall
     
    David K. Wall, Feb 13, 2004
    #3
  4. Chris

    Bill Guest

    (Chris) wrote in message news:<>...

    > #!/usr/local/bin/perl
    > print "Content-Type: text/plain\n\n";
    > use LWP::Simple;
    > $content = get ("http://www.webbuyeruk.co.uk/index.htm");
    > print " This is Content:\n\n $content \n\n";
    > exit;
    >
    > (above as seen in google postings) but no contents appear on my
    > screen? Any help appreciated! I'm using perl 5.8 on windows 2K.


    Works here, 5.8, XP. are you running it via

    c:> perl filename.pl

    or as

    c:> filename.pl

    or by clickin on filename? If the latter two, you need
    /usr/local/bin/perl.exe to exist, of course :/
     
    Bill, Feb 13, 2004
    #4
  5. Chris <> wrote:

    > Apologies for the mail



    What mail?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Feb 13, 2004
    #5
  6. David K. Wall wrote:

    > If you're running this as CGI under Apache this might be a problem.


    I dont think he even realises he needs a web server to run it.

    gtoomey
     
    Gregory Toomey, Feb 14, 2004
    #6
  7. Chris

    Matt Garrish Guest

    "Bill" <> wrote in message
    news:...
    > (Chris) wrote in message

    news:<>...
    >
    > > #!/usr/local/bin/perl
    > > print "Content-Type: text/plain\n\n";
    > > use LWP::Simple;
    > > $content = get ("http://www.webbuyeruk.co.uk/index.htm");
    > > print " This is Content:\n\n $content \n\n";
    > > exit;
    > >
    > > (above as seen in google postings) but no contents appear on my
    > > screen? Any help appreciated! I'm using perl 5.8 on windows 2K.

    >
    > Works here, 5.8, XP. are you running it via
    >
    > c:> perl filename.pl
    >
    > or as
    >
    > c:> filename.pl
    >
    > or by clickin on filename? If the latter two, you need
    > /usr/local/bin/perl.exe to exist, of course :/


    Why do you say that? Windows will check the registry in the latter two cases
    to determine the default application to use to run .pl files. All he needs
    is a correct file association.

    Matt
     
    Matt Garrish, Feb 14, 2004
    #7
  8. Chris

    Chris Guest

    Thanks for the comments to my posting (not mail),

    Will try your comments tonight Bill and post a follow up tomorrow, I'm
    not running through a web server as I have downloaded perl 6.0 and am
    running in DOS whilst having a permanent TCP/IP connection, the result
    may be different when I run it from home as I was running it at work
    behind a firewall.

    Thanks for the input so far.
     
    Chris, Feb 16, 2004
    #8
  9. Chris <> wrote:

    > I have downloaded perl 6.0



    I don't think you have.

    There is no Perl 6 yet...


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Feb 16, 2004
    #9
  10. Chris

    Chris Guest

    Thanks all for the input Bill, your script works great! Thanks again.
     
    Chris, Feb 16, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cloud Burst
    Replies:
    11
    Views:
    1,035
  2. Replies:
    3
    Views:
    12,181
    Beauregard T. Shagnasty
    Jan 10, 2006
  3. Replies:
    6
    Views:
    124
    Sherm Pendley
    Jan 1, 2005
  4. ste-m
    Replies:
    1
    Views:
    319
  5. Replies:
    17
    Views:
    96
    Rustom Mody
    May 22, 2014
Loading...

Share This Page