View Full Version : Batch file
imported_Gryphon
10-30-2002, 09:42 PM
:wtf: Ok I have fried my brain trying to figure this out.
I want a batch file to post two variables to a php script every X seconds. Now I know this is about 3 lines of code that I would normally teach myself to do, yet I can't seem to find any information in two hours of searching.
Thanks
Strike
10-31-2002, 12:08 AM
Um, OS(/shell)?
imported_Gryphon
10-31-2002, 02:00 AM
Sorry, WinXP Pro
I have a script on my site that querys a game server for information, I want to set it up to query every 5 seconds and store the data in a mysql database.
My problem is that my server offers a cron job at the most of once per day. I would like to just run a batch file on a home computer that will trigger a remote php script.
stuka
10-31-2002, 11:56 AM
well, in Win2K, the line:"f:\program files\internet explorer\iexplore.exe" www.coderforums.net opens up the cf web site in IE, and sleep 5 sleeps for 5 seconds, so I imagine that putting that in a batch file in a neverending loop would do what you need. Well, wait a sec...that opens a new IE window every time...so it might suck. But it's a start....
imported_Gryphon
10-31-2002, 01:09 PM
Hehe thanks, yeah I got a loop going but it opens a page every time as well.
I have a teamspeak server and it sends a http post to a php script every 5 minutes, where then I have it execute a whole bunch of other stuff; if I could simulate that I would be golden.
stuka
10-31-2002, 01:18 PM
ya know what? lemme check something - I have a tiny little utility program that might do it for you - you'd have to create a text file for the HTTP post, but you've got the syntax for that, right?
My program just dumps data to a specific IP address & port from the command line. I can attach it here if you'd like.
imported_Gryphon
10-31-2002, 02:11 PM
That would be great, all I need is a little direction and I think I can solve this problem. I'm just having a hard time finding examples or something similar to what I need.
stuka
10-31-2002, 02:24 PM
OK - here's the program. All it does is send a data stream to a given ip address & port. So you'll need to create a valid HTTP Post request in a text file, then just use this program like so:ipsend http_post.txt server_ip 80
imported_Gryphon
10-31-2002, 02:25 PM
Gracias
stuka
10-31-2002, 02:28 PM
np man
jamessan
10-31-2002, 04:15 PM
Or you could download netcat and write a script to use that.
stuka
10-31-2002, 04:24 PM
jamessan: he doesn't need to read the data - he needs to trigger a script on the server on an interval basis. For his purposes, this little program should succeed nicely.
jamessan
10-31-2002, 05:38 PM
netcat can do that, but if that program works then I guess his problem is solved
imported_Gryphon
10-31-2002, 06:41 PM
Yup, its solved, thanks :D
stuka
11-01-2002, 10:43 AM
Gryphon: cool, glad to help.
jamessan: Didn't know that about netcat, but I guess it makes sense - I was guessing by name, and forgetting that cat works 2 ways. <edit>Is there a netcat version for Win32? I didn't find one - just a Unix version on freshmeat</edit>
jamessan
11-01-2002, 12:09 PM
From freshmeat:
http://www.atstake.com/research/tools/index.html#network_utilities
:)
<edit>Also, I'm pretty sure you can get a version of netcat with cygwin if you prefer the command line like I do.</edit>
stuka
11-01-2002, 12:55 PM
Cool - I'm no expert on freshmeat, and found the page I did through google.
Strike
11-01-2002, 01:03 PM
Originally posted by Stuka
Cool - I'm no expert on freshmeat, ...
I'll ... leave that one alone
Damn me and my gutter-bound mind.
stuka
11-01-2002, 01:05 PM
heh...at least I didn't claim to be an expert on fresh meat! :D
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.