View Full Version : script to access a site
hey101
02-24-2009, 01:48 PM
ok I need a program to access a website every 30 minutes. Im using co.nr for my domain. I run a web site from my pc and the ip changes about every 30 min-1 hour. If i could get a program or script to tell when my ip changes and then visit the url immediately in the background, that would be great. I dont want it to open in firefox because if im working then its annoying to close the new tab or window it just opened in.
Only problem is that i cant code that well. I can basically make a hello world program but thats to my extent in c# or c++. IN VB i can make a web browser using the commands that are already there. VBS or autohotkey would be good but im only good with ahk and i cant get it to detect an ip change. vbs i just suck at. Serious guidance would be helpful but source code ( well you would become my best friend) :P
tomws
02-24-2009, 02:28 PM
Sounds like you need to check out a service like DynDNS: http://www.dyndns.com/about/home_solutions.html
hey101
02-24-2009, 02:45 PM
i have looked at that but i cant find anything that will help me out since co.nr is free and isnt transferable. And all i have to do when my ip changes is visit a link so a program would be better to use, since i dont want to pay for it.
oesxyl
02-24-2009, 03:56 PM
i have looked at that but i cant find anything that will help me out since co.nr is free and isnt transferable. And all i have to do when my ip changes is visit a link so a program would be better to use, since i dont want to pay for it.
try this software:
http://www.dyndns.com/support/clients/
best regards
tomws
02-24-2009, 04:12 PM
This would be pretty easy on a Linux box with a cron job, wget and diff. But Windows... boo. If the DynDNS client won't work and if there's not a tool already available for this (there probably is somewhere), you could try this:
Download wget for windows: "Complete package, except sources", http://gnuwin32.sourceforge.net/packages/wget.htm
Download diff for windows: "Complete package, except sources", http://gnuwin32.sourceforge.net/packages/diffutils.htm
Put this batch file in the c:\ directory (I called it ipdiff.bat) and schedule Windows task manager to hit it every xx minutes:
@"C:\Program Files\GnuWin32\bin\wget.exe" --quiet --output-document="c:\ipdiff_this.txt" http://www.showmyip.com/simple/
@"C:\Program Files\GnuWin32\bin\diff.exe" "c:\ipdiff_this.txt" "c:\ipdiff_last.txt"
@if errorlevel 1 "C:\Program Files\GnuWin32\bin\wget.exe" --quiet --spider http://www.example.com
@copy "c:\ipdiff_this.txt" "c:\ipdiff_last.txt"
Assumptions (change these as needed):
-diff and wget are installed to the default location.
-tracking files are stored to the root directory.
-the website to hit if there's an ip difference is example.com.
The batch file is far from robust, but seems to work. Windows shell scripting would be a better alternative, and it may actually include utilities like the GNU tools.
EDIT: By the way, even with the --quiet option, I still get some wget output. Didn't take the time to figure out why.
hey101
02-24-2009, 04:37 PM
ok thanks. that works. once i configured it right then its great.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.