On Wednesday, Sep 3, 2003, at 06:08 US/Pacific, Sara wrote:


#!/usr/bin/perl

use LWP::Simple;

print "Content-type: text/html\n\n";

$url = 'http://yahoo.com';

$html = get($url);
[snip]
$html =~ s|<head>.*?<\/head>||s;

print "$html\n";


what you get from 'get' is a scalar $html
that is the WHOLE PAGE - so you do not want
to step over that whole page with the sort of
'global' pattern match of

$html =~ s|<head>.*?<\/head>||s;

so the 'foreach ' loop was not going to work

because the page you get back is of the form:

<html><head>

<title>Yahoo!</title>
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html"; l r (cz 1 lz 1 nz 1 oz 1 vz 1) gen true for "http://www.yahoo.com"; r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html"; l r (n 0 s 0 v 0 l 0) gen true for "http://www.yahoo.com"; r (n 0 s 0 v 0 l 0))'>
<base href=http://www.yahoo.com/ target=_top>
<style type="text/css"><!--
.yhmpabd{border-left:solid #4d99e5 1px;border-right:solid #4d99e5 1px;border-bottom:solid #4d99e5 1px;}
.yhmnwbd{border-left:solid #9b72cf 1px;border-right:solid #9b72cf 1px;}
.yhmnwbm{border-left:solid #9b72cf 1px;border-right:solid #9b72cf 1px;border-bottom:solid #9b72cf 1px;}
//--></style>
<script language=javascript><!--
lck='',sss=1062732386;//--></script>
<script language=javascript>
var b,d,l='',n='0',r,s,y;
y=' '+document.cookie+';';
if ((b=y.indexOf(' Y=v'))>=0) {
y=y.substring(b,y.indexOf(';',b))+'&';
if ((b=y.indexOf('l='))>=0) {
l=y.substring(b+2,y.indexOf('&',b));
if((b=y.indexOf('n='))>=0)n=y.substring(b+2,y.indexOf('&',b));
}
}
d=new Date();
s=Math.round(d.getTime()/1000);
r=Math.round(parseInt(n,32)%1021);
if (lck!=l) {
document.write('<meta http-equiv="Expires" content="-1">');
if (location.search.indexOf('r'+r+'=')!=1) {
location.replace('http:// '+location.hostname+location.pathname+'?r'+r+'='+s);
}
}
</script>
</head>


ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to