php - 我如何使用浏览直接 URL 执行 Cron 作业

标签 php codeigniter cron

我的应用程序在 hostgater.com 上运行。 我在我的服务器中创建了一个 Cron 作业调度程序并设置所有这些参数。

目前效果良好

command parameter like /home3/user/public_html/sendemial.php.

它不起作用,我尝试执行 MVC Controller 操作 URL,例如

command parameter like http://voola.org/user/sendemail

我也尝试过使用 iframe,但它不起作用。我非常担心在 Hostgater 服务器中执行直接 url。

任何帮助将不胜感激:)

最佳答案

examole谢谢@Orangepill,你太棒了。使用curl 发挥其工作魅力。下面是我的代码示例

$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://sadf/profiles/emailalert");
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
$result=curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);
if($result){
    echo "execute by curl ok and sending mail";
}else{
    echo "not execute curl funation";
}

关于php - 我如何使用浏览直接 URL 执行 Cron 作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18798968/

相关文章:

php - 如何从 PHP 调用 Win32 API?

php - MySQL 回滚 PHP(不是 MySQL)错误

php - 如果结果为空,如何获取字段名称? [PHP-Codeigniter]

linux - $ * * * * * echo "hi"=> blado.kdb : command not found

mysql - 如果 [条件] 未满足,如何对 shell 命令进行排队?

postgresql - pg_dump 重定向错误信息

php - 在 php 中调用大量 mysql_query 后出现 500 错误

php - 让 php 读取通过 javascript 创建的表单?

codeigniter - 禁用下拉列表中之前使用 codeigniter 选择的项目

codeigniter - 需要 codeigniter url 的帮助