Call a PHP script on remote server without SSH

I’ve just finnished working on a project where I needed to schedule a PHP script to upload and then process a CSV file. For various reasons we weren’t able to create a cron job, so in the end we decided to set a scheduled task up on a Windows server that would then run a VBS script that would in turn call the PHP script on the other server.

Call LogEntry()

Sub LogEntry()

	On Error Resume Next 

	Dim requestObj
	Dim url 

	Set requestObj = CreateObject("Microsoft.XMLHTTP") 

	url = "" 
	'create a url and querystring "POST", url , false
	'add method and add url to request object

	'send the request

	Set requestObj = Nothing
	'clear the request object

End Sub

Change the url variable to the address of the script that you want to call and then save the file as a .vbs file which you can then run using the built in windows task scheduler.

4 thoughts to “Call a PHP script on remote server without SSH”

  1. Mmmm, VB goodness. Actually, no. I’m so glad I walked away from the two years I would have spent doing it at college. However, I think with our combined efforts, we wrote some awesome things for that project. What with the batch files and such.

    If I was bothered, I’d edit the batch files to run a vbs script like the one above, but what I’ve done works, and that’s all they can expect, given the situation.

  2. Yeah, well all those years of ASP hell were worth something after all.

  3. You know we really should re-write the batch files in the same way, and possibly amalgamate everything into a single script…


  4. If it was for a more deserving, friendly and nice client. Sure. At the moment this works, and I see no reason to change it.

Comments are closed.