ASP页面在后台调用PHP页面

ASP页面在后台调用PHP页面

问题描述:

I have a Classic ASP site that uses "crontab" to invoke a process every hour.

"1.php" (Linux) is run hourly (via crontab) and invokes "2.php" (Windows) which invokes (via curl) "3.asp" (Windows) which creates and invokes (via ASP's Server.Transfer) "4.php" (Windows) which invokes a REST API.

Everything works great until the Server.Transfer to "4.php" -- it doesn't!

There are no "echo" (Linux) or "Response.Write" (Windows) statements. Processing involves database and file system access.

I know that I had to use "curl" (or "wget") to invoke a page from a "cron" job because it isn't running within a browser.

I thought I could use Server.Transfer (not Response.Redirect) within ASP. Apparently, Server.Transfer can only be used to transfer to another ASP page.

Might someone suggest a solution? Thank you in advance.

我有一个经典ASP站点,它使用“crontab”每小时调用一个进程。 p>

“1.php”(Linux)每小时运行一次(通过crontab)并调用 “2.php”(Windows)调用(通过curl) “3.asp”(Windows)创建 并调用(通过ASP的Server.Transfer) “4.php”(Windows)调用REST API。 p>

一切正常,直到Server.Transfer to“4.php” - 它没有! p>

没有“echo”(Linux)或“Response.Write”(Windows)语句。 处理涉及数据库和文件系统访问。 p >

我知道我必须使用“curl”(或“wget”)来调用“cron”作业中的页面 因为它没有在浏览器中运行。 p> \ n

我以为我可以在ASP中使用Server.Transfer(而不是Response.Redirect)。 显然,Server.Transfer只能用于转移到另一个ASP页面。 p>

可能有人建议解决方案? 提前谢谢。 p> div>

You could try a server http request

Dim objXML
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
objXML.Open "GET", "http://fullurlto/4.php", false 
objXML.Send
Response.Write objXML.responseText
Set objXML = nothing