Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Reading html into a source file

Reply
Thread Tools

Reading html into a source file

 
 
Chris
Guest
Posts: n/a
 
      02-13-2004
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.
 
Reply With Quote
 
 
 
 
Gregory Toomey
Guest
Posts: n/a
 
      02-13-2004
Chris wrote:

> #!/usr/local/bin/perl

Unix shebang line

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


Windows operating system??

gtoomey
 
Reply With Quote
 
 
 
 
David K. Wall
Guest
Posts: n/a
 
      02-13-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (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
 
Reply With Quote
 
Bill
Guest
Posts: n/a
 
      02-13-2004
(E-Mail Removed) (Chris) wrote in message news:<(E-Mail Removed) m>...

> #!/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 :/
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      02-13-2004
Chris <(E-Mail Removed)> wrote:

> Apologies for the mail



What mail?


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Gregory Toomey
Guest
Posts: n/a
 
      02-14-2004
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
 
Reply With Quote
 
Matt Garrish
Guest
Posts: n/a
 
      02-14-2004

"Bill" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> (E-Mail Removed) (Chris) wrote in message

news:<(E-Mail Removed) m>...
>
> > #!/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


 
Reply With Quote
 
Chris
Guest
Posts: n/a
 
      02-16-2004
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.
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      02-16-2004
Chris <(E-Mail Removed)> wrote:

> I have downloaded perl 6.0



I don't think you have.

There is no Perl 6 yet...


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Chris
Guest
Posts: n/a
 
      02-16-2004
Thanks all for the input Bill, your script works great! Thanks again.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Page Load Times into HTML Source as a HTML Comment ste-m Javascript 1 11-01-2006 03:18 AM
using dreamweaver : how can I insert HTML file into another html file? johnsonholding@yahoo.com HTML 3 01-10-2006 08:06 PM
need help reading source code: HTML::Parser ioneabu@yahoo.com Perl Misc 6 01-01-2005 08:06 PM
Need to concatenate all files in a dir together into one file and read the first 225 characters from each file into another file. Tony Perl Misc 5 04-19-2004 03:28 PM
is there a way to "include" source file B.html in source file A.html? Cloud Burst HTML 11 01-09-2004 02:49 AM



Advertisments