Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 27th, 1999, 04:17 PM
miguelgarcia
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Does anyone know where I can find a perl module/program that will strip the text out of a HTML file.

Reply With Quote
  #2  
Old August 28th, 1999, 05:20 PM
dlamb
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Here's a small one I just did for a buddy. This particular one grabs a table from an html file ( it has a nested table in it ) and prints the out put to a file. Then he just included the file with php3.

Look at it closely, it's a simple script, and should be easy to customize. Here it is:

#!/usr/bin/perl

$file="playlist.code";
$original ="playlist.html";

open (FILE, $original);
@lines=<FILE>;
close FILE;
#print @lines;

#First line
@playlist[0] = "<br>";

$found = 0;
$count = 0;
$webdog = "<table";
foreach $line (@lines) {
if ($line =~ /$webdog/i) {
$found++;}
if ($found > 1) {
push (@playlist,$line);
if ($line =~ /</table>/i){
$count++;
last if ($count == 2);
}
}
}
print @playlist;
#open (FILE, ">$file");
#foreach $playlist(@playlist){
# print FILE $playlist;
#}
close FILE;

The script probably could be a bit simpler, but here you go. Note this only grabs whole lines. If you will need to grab, say, just half of the last line, you'll have to monkey with it (using $' and $` most likely).

Reply With Quote
  #3  
Old August 28th, 1999, 05:21 PM
dlamb
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
oops - that script actually prints out the results to stdout, to print to a file uncomment that small loop at the end.

Reply With Quote
  #4  
Old August 28th, 1999, 10:15 PM
curtdog
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I would like to be able to grab html from a remote site (news headlines) once a day (cron) and write it to a file that I can include in my page. I have written a php script that grabs headlines from a site and writes it to my file, but this is slow.

------------------
Christopher Curtis
C Double Web Development
http://c-double.com

Reply With Quote
  #5  
Old November 8th, 2000, 04:40 PM
JakeyG JakeyG is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 22 JakeyG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
use LWP::Simple;

$html = get("http://www.mysite.com");
print $html;

Works for me - I learnt it from a book about two hours ago!

------------------

Reply With Quote
  #6  
Old January 2nd, 2001, 04:51 AM
Kilokahn Kilokahn is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: Lorain, OH, USA
Posts: 0 Kilokahn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Kilokahn
Okay, I haven't tried that out yet but I bet dollars to nickels it works. Now I have a little question of my own... Since I am a newbie...

I want to know how to do this and instead of printing to a new file, print directly out of the cgi.

Also... Be able to filter for certain things and replace them with other things... Like put <P> in places where <BR> are.

---

This also brings up another problem I am having. I want to embed an external CGI to an internal CGI my friend and I are working on.

Many of them are like a counter, a clock and even other things. They are in the same directory as our sidebar generator (the cgi we use to get the data for our fields) it is just we want to impliment these CGI files in this sidebar CGI so it will be seamless.

Any quick code snippets, suggestions or such, please e-mail or reply. Thanks!

Chris

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Perl script that will pull text out of HTML file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway