Running a php script using wget and Windows Scheduler -
on laptop, have installed webserver , have written script. accessing script through http://localhost/test/search.php
in browser makes run properly: searches for, downloads , stores tweets.
i want create script run automagically every 20 minutes, downloaded , installed wget
windows in c:\program files\gnuwin32\bin\wget.exe
. created windows task next action (filled in on actions tab):
program/script: "c:\program files\gnuwin32\bin\wget.exe" add together arguments (optional): -o - -q -t 1 http://localhost/test/search.php
as expected, every 20 minutes command line opens run script. however, nil happens. script isn't initialized. sure paths correct. causing script doesn't executed? command line disappears in matter of milliseconds, cannot see says...
you mention 2 path search.php
: 1 /test
, other /ting
. create sure using same in browser , wget.
if request page not exist, no error if supply -q
. replace -v
or --verbose
see wrong.
c:\gnuwin32\bin\wget.exe -o - --verbose -t 1 http://localhost/test/search.php --2013-02-25 23:42:03-- http://localhost/test/search.php resolving localhost... ::1, 127.0.0.1 connecting localhost|::1|:80... connected. http request sent, awaiting response... 404 not found 2013-02-25 23:42:03 error 404: not found.
when command line working, can focus on running task scheduler.
you can run task yourself, or other accounts. using local service
allows run without providing password, if logged out. create shure business relationship selected has permission directory wget located.
others have mentionned must set path of scheduled task, or else operationnal code (2) showed in screen shot. create sure windows find wget.exe
dependencies, namely libeay32.dll
, libssl32.dll
.
.
finally, simplify. run php command line. the link above illustration of that simple script.
write code can phone call search.php standalone command line. no need set http client , web server in between. here a bunch of sample scripts various twitter related operations.
php windows command-line localhost wget
No comments:
Post a Comment