Gossamer Forum
Home : General : Perl Programming :

Capture HTML from another domain name.

Quote Reply
Capture HTML from another domain name.
Dear,

I would like to know how can I capture data from another file on the web.
What I want to do is captures my local weather forecast station values everyday and put it in my home page with automatic refresh. I just need to capture in this case the <IMG SRC="../images/p6.gif" HEIGHT=78 WIDTH=64> and <CENTER><B><FONT COLOR="#0000ee">20 </FONT><SUP>o</SUP>C /<FONT COLOR="#FF0000">23 </FONT><SUP>o</SUP>C</B></CENTER> .

Source of the file of my weather station.
eg:
<html>
<head>

<TABLE WIDTH="100%" >
<TD WIDTH="50%">
<CENTER><B> <FONT COLOR="#1932cc"> October</FONT>/<FONT COLOR="#1932cc">13</FONT><FONT
COLOR="#FFFFFF"></FONT></B><BR></CENTER>
<CENTER><P><IMG SRC="../images/p6.gif" HEIGHT=78 WIDTH=64></P></CENTER>
<CENTER><B><FONT COLOR="#0000ee">22
</FONT><SUP>o</SUP>C /
<FONT COLOR="#FF0000">26
</FONT><SUP>o</SUP>C</B></CENTER>

</TD>
<TD WIDTH="50%">
<CENTER><B><FONT COLOR="#1932cc"> October</FONT>/<FONT
COLOR="#1932cc">14</FONT></B><BR></CENTER>
<CENTER><P><IMG SRC="../images/p6.gif" HEIGHT=78 WIDTH=64></P></CENTER>


<CENTER><B><FONT COLOR="#0000ee">20
</FONT><SUP>o</SUP>C /
<FONT COLOR="#FF0000">23
</FONT><SUP>o</SUP>C</B></CENTER>
</TD>
</TABLE>
</BODY>
</html>


Regards,

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture HTML from another domain name. In reply to
Use LWP:Simple or better yet create a copy of the file with only the codes that you want to appear in another web page and then use SSI calls.

Regards,

Eliot Lee

Quote Reply
Re: Capture HTML from another domain name. In reply to
Thanks, I'll try it.


Regards,

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture HTML from another domain name. In reply to
You're welcome.

Regards,

Eliot Lee

Quote Reply
Re: Capture HTML from another domain name. In reply to
I already fetch the HTML page at http://www.lookeasy.net/cgi-bin/weather.cgi, but how can I pick up the temperatures values only.


Regards,

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture HTML from another domain name. In reply to
if ($source =~ m!<FONT COLOR="#FF0000">(\d+)!) {
$temperature = $1;
}

Jerry Su
Quote Reply
Re: Capture HTML from another domain name. In reply to
I make a new cgi called forecast.cgi using LWP::UserAgent instead of LWP::Simple and I use a variable like this,
$filter =~ s|</TD>
<TD WIDTH=\"50%\"(.*?)</BODY>|</b></table></body>|sig;
I made this way because it's more easy to track the HTML code changes.

See the new cgi working at http://www.lookeasy.net/cgi-bin/forecast.cgi

and compare to the old http://www.lookeasy.net/cgi-bin/weather.cgi

Now I just need to make it more nice and use SSI call.

Thanks for yours helps,


Regards,

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture HTML from another domain name. In reply to
Thanks, but I made it another way.


Regards,

Nuno Duque
--------------------
Macau Search Engine
searchmacau.com
Quote Reply
Re: Capture HTML from another domain name. In reply to
Nice Script - is it possible to get this?



Quote Reply
Re: Capture HTML from another domain name. In reply to
I made this script for my own and for sell but currently not finished yet, if you want to find something for free go to http://www.hotscripts.com/...her&category=all.

Regards,

Nuno Duque
--------------------
Macau Search Engine
inmacau.com
Quote Reply
Re: Capture HTML from another domain name. In reply to
Any body interested in a php version than do mail me

Best Regs
JackofNone

Quote Reply
Re: Capture HTML from another domain name. In reply to
The BEST weather script out there, IMHO, and suffering the same delays as Links SQL for it's next version (genious takes work!) is HamWeather.

If you run your own server, you can do just about anything with it. Literally, Anything.

Check out http://hamweather.com

I use it on http://postcards.com in a virtually unmodified form to include weather forecasts in our postcards, and it's very, very popular.



PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ