jackaroo Posted November 2, 2005 Posted November 2, 2005 I successfully configured a cron job in cpanel to run a php script. Now I would like to run that script remotely from VBScript. Dim Controller, RemoteScript Set Controller = WScript.CreateObject("WSHController") Set RemoteScript = Controller.CreateScript("http://www.MyWebSite.com/MyPath/MyScript.php") RemoteScript.Execute I have placed '#!/usr/bin/php' in the script. Can anyone tell me why this doesn't work? Thanks Quote
TweezerMan Posted November 2, 2005 Posted November 2, 2005 Welcome to the forums, jackaroo! From what I can tell by reading the WSH documentation, the methods you're using in your script do not support running a script via a URL, nor do they support remote execution of scripts on a non-Windows server. To run a script on your account by merely performing an HTTP 'GET' request on its URL, I believe the following script would do what you want: >Dim url 'URL to retrieve Dim sHTML 'String to hold HTML sent by server url = "http://www.MyWebSite.com/MyPath/MyScript.php" sHTML = HTTPGet(url) Function HTTPGet(strURL) Dim strReturn Dim objHTTP If Len(strURL) Then Set objHTTP = WScript.CreateObject("Microsoft.XMLHTTP") objHTTP.open "GET", strURL, False objHTTP.send strReturn = objHTTP.responseText End If HTTPGet = strReturn End Function Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.