[SOLVED] Need help with Windows Task Scheduler fake cron job

I use this standard VBS script that everyone seems to use:

'begin VBS script code: 

Call LogEntry()

Sub LogEntry()

'Force the script to finish on an error.
On Error Resume Next

'Declare variables
Dim objRequest
Dim URL

'The URL link.
URL = "http://URL-to-website-script-to-run"

Set objRequest = CreateObject("Microsoft.XMLHTTP")

'Open the HTTP request and pass the URL to the objRequest object
objRequest.open "GET", URL , false

'Send the HTML Request
objRequest.Send

'Set the object to nothing
Set objRequest = Nothing

End Sub

'end VBS script code

Is there any way of getting it to send a different user agent string, like the custom string Googlebot uses??

I want to ramp up my site’s security since getting hit hard yesterday by a flood of spoofed IP’s and faked UA strings between 6 and 7 am, looked like the world in general was trying to bring my site down to its knees!! #-o #-o 8O

I just would like to have my own custom UA string that I can check for via my htaccess file, I added an anti-hotlinking check last night which seems to work, now I just want to filter on UA strings for bots and harvesters and general bad characters causing grief!! :wink:

George

Well, guess I’m the only one using this code!! :lol: :lol: I reworded my search string on Google so many times I’ve lost track! #-o
Well last night it paid off, I found my answer, now I’ll share it so this question won’t go unanswered. :wink:
The page I found the answer on: http://www.europeanexperts.org/question/Languages/ASP/VBS/1364.html back from 2005! #-o

So here’s the code that we start with, used by anyone that has no CRON available with their webhost:

'begin VBS script code: 

Call LogEntry()

Sub LogEntry()

'Force the script to finish on an error.
On Error Resume Next

'Declare variables
Dim objRequest
Dim URL

'The URL link.
URL = "http://URL-to-website-script-to-run"

Set objRequest = CreateObject("Microsoft.XMLHTTP")

'Open the HTTP request and pass the URL to the objRequest object
objRequest.open "GET", URL , false

'Send the HTML Request
objRequest.Send

'Set the object to nothing
Set objRequest = Nothing

End Sub

'end VBS script code

And here’s the modified script to send a custom user-agent string plus a referer string based on the php script that is triggered on the website:

'begin VBS script code: 

Call LogEntry()

Sub LogEntry()

'Force the script to finish on an error.
On Error Resume Next

'Declare variables
Dim objRequest
Dim URL

'The URL link.
URL = "http://URL-to-website-script-to-run"

Set objRequest = CreateObject("Microsoft.XMLHTTP")

'Open the HTTP request and pass the URL to the objRequest object
objRequest.open "GET", URL , false

'Set referer string
objRequest.setRequestHeader "REFERER", URL

'Set a custom user agent string
objRequest.setRequestHeader "User-Agent", "Custom-User-Agent-String-Of-Choice"

'Send the HTML Request
objRequest.Send

'Set the object to nothing
Set objRequest = Nothing

End Sub

'end VBS script code

Hope someone else can make use of this, just customize the “Custom-User-Agent-String-Of-Choice” part with some string that is meaningful to you, makes tracking entries in the access log of your website easier when you know what was accessing which script in this way, it doesn’t show as a “generic” spam bot or harvester bot user agent string. :wink:

George