Help importing text - Page 2

User 187934 Photo


Senior Advisor
20,271 posts

I would think a web Scrapper would be able to do what you want.
http://web-harvest.sourceforge.net/index.
http://sourceforge.net/projects/snoopy/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2308412 Photo


Registered User
12 posts


The application is called Weather Display. It takes data from a weather station, and then databases it and makes reports, jpg/gif images for web sites. There is a function where you design your web page and put in tags, as seen on page 55.

Weather Display takes the page as a template where you have...

Right now in Lima OH the winds are from the %dirlabel% at %avgspd% mph

and when it writes the index.html to my site it will have the data in there so it looks like....

Right now in Lima OH the winds are from the SW at 26.9 mph

It's a pretty cool program for those of us who like following the weather.

SirAGE sez:
Is this the page you want to add the KAOH.txt too? http://www.limaweather.com/

If not could you provide a link to that page.


That will be the page where it will ultimately go. That page is published by Weather Display, and then FTPed to the site along with the image "index.gif" They are created every 10 minutes and FTPed.

What I'm trying to do is justify the image to the left and put a box with the KAOH.TXT info on the right. That way someone can see the differences in environment from the weather station, and out at the airport.

Eric, I'll take a look at those two codes and see if they will fit the bill. Thanks.
User 187934 Photo


Senior Advisor
20,271 posts

I got snoopy to extract the page contents.
http://ericrohloff.com/test/snoopy/

Just need formatting and get it sent to a database so we can populate a table.;)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2308412 Photo


Registered User
12 posts

But is Snoopy an external program? I must have misunderstood the instructions.

I've been playing around with this code...

<p><?Php
$file = $_SERVER['DOCUMENT_ROOT'] . "limaweather.com/KAOH.TXT";
$contents = file($file);
$string = implode($contents);
echo $string;
?></p>


According to a FAQ, this could be coded right on the index.html and when someone loads the page, it pulls the KAOH.TXT right in. I've not gotten it to work yet.

I'm going to have to sign off for the night, we're getting some 55 mph winds up here now, and power is flickering. At least we were spared the storms that went though Illinois and Kentucky this afternoon.

User 187934 Photo


Senior Advisor
20,271 posts

Save this page as a .php then create a iframe code to populate this page into you html page.

<?php
include "Snoopy.class.php";
$snoopy = new Snoopy;

if($snoopy->fetch("http://www.limaweather.com/KAOH.TXT"))
{
//echo "response code: ".$snoopy->response_code."<br>\n";//
while(list($key,$val) = each($snoopy->headers))
//echo $key.": ".$val."<br>\n";//
echo "<p>\n";

echo "<PRE>".htmlspecialchars($snoopy->results)."</PRE>\n";
}
else
echo "error fetching document: ".$snoopy->error."\n";

?>


I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2308412 Photo


Registered User
12 posts

Excuse the fogginess in understanding this. I was up about 8 hours later than I'm used to with the storms moving through the area.

You're saying put this code, and the Iframe on the template so when it's published to as index.html to the web site it will work? Sorry, but I'm still trying to understand how this all goes together.
User 187934 Photo


Senior Advisor
20,271 posts

Yes, In the example on my site I have the code in the above example in a index.php page. I then place an Iframe on my html page linking to the php page. You also have to have the Snoopy.class.php in the same directory. Publish it all and Presto Chango.
I also got this php code to work but the data needs to be formatted better.

<?PHP

$file_handle = fopen("http://www.limaweather.com/KAOH.TXT", "r");
while (!feof($file_handle)) {
$line = fgets($file_handle);
echo $line;
}
fclose($file_handle);

?>



I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2308412 Photo


Registered User
12 posts

Gotcha!

I was able to make this work by renaming "index.html" to "index.shtml" and using this code.

<!--#include virtual="KAOH.TXT" -->


The trick in both cases is to somehow keep the format of carriage returns in the same format, which is what I think you had problems with?

I'll try yours and see if I get the same result.

It occurs to me that I may have to write something on the weather station end to take in the KAOH.TXT file, add breaks at the beginning of each line, and return it with a different name which is what I display.
User 187934 Photo


Senior Advisor
20,271 posts

If you can do the format at the station it would be a lot easier to place the data where you want it to display.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2308412 Photo


Registered User
12 posts

This line works,


<table style="width: 300px; table-layout: fixed;">
<tr>
<td style="width: 100%;">
<pre style="word-wrap: break-word;"><!--#include virtual="KAOH.TXT" --></pre>
</td>
</tr>
</table>


Take a look at http://www.limaweather.com/index.shtml but the question is will it work under html

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.