Re: Creating website alerts
You could just make a web browser in your form, and then continue refreshing the page with a timer. In sync with the timer grab the html, place it as a string. Then the next timer event, compare it to the last string...... Yea, it is explained VERY badly. But I hope you can make some sense out of what I said.
Re: Creating website alerts
Quote:
Originally Posted by thegoat
Hey, I'm pretty new to visual basic and I am having trouble creating a code. What I want to create is a program that monitors a website (keeps on refreshing it), and when there is a change in the code of the website/size/anything, it will sound an alarm. If anyone can point me in a certain direction or help I would be most grateful. Thanks J
Could try this:
Use iNet to download the sites source
Save source to a file (file1)
begin loop
X minutes later download the source again
Save source as file2
Compare file1 to file2
if its the same, do stuff
Move file2 to file1
loop
maybe i'll code it for fun in a bit
good luck
Re: Creating website alerts
you can use inet to download only the head of the document, which lists the last-modified date. this will tell you when it changed, and saves you from downloading the whole page. quicker, and saves everyone bandwidth.
check out:
http://www.pgacon.com/BVColumns/BV13.HTM
Re: Creating website alerts
Quote:
Originally Posted by rnd me
you can use inet to download only the head of the document, which lists the last-modified date. this will tell you when it changed, and saves you from downloading the whole page. quicker, and saves everyone bandwidth.
check out:
http://www.pgacon.com/BVColumns/BV13.HTM
That would be an efficient answer. But I'm wondering, if the site is using ASP or another server side scripting language to dynamically alter the page's contents, would the header reflect that? I haven't done enough work with headers to know for sure, but I always assume that I should download the entire page just to be sure...
Re: Creating website alerts
if the dynamic asp page will return the same info to the browser, it is said to be unmodified.
also bear in mind that the header has the "content-length" property. changing html and still having the exact same byte count is rare.
note that downloading the full page will download the header as well, and if the server deems the content unchanged, usually it tells your browser to display a cached copy.
using head request is just as easy as a GET request, you just use the word "HEAD" instead of "GET".
heres an axample of the info returned by a typical head request.
_________________________
response Headers:
Date Mon, 19 Mar 2007 18:16:42 GMT
Server Apache/1.3.34 Ben-SSL/1.57 (Unix) mod_gzip/1.3.26.1a mod_fastcgi/2.4.2 mod_throttle/3.1.2 Chili!Soft-ASP/3.6.2 FrontPage/5.0.2.2635 mod_perl/1.29 PHP/4.4.2
Vary *
Last-Modified Tue, 05 Nov 2002 00:58:59 GMT
Etag "d3049b-55fe-3dc717d3"
Accept-Ranges bytes
Keep-Alive timeout=15
Connection Keep-Alive
Content-Type text/html
Content-Encoding gzip
Content-Length 4338