我的批处理文件有问题
如果我访问:http://localhost:8080/cron/cron.php
我收到带有消息的电子邮件Yeah, message send via Gmail
这是我的cron.php
<?php
require_once 'simplehtmldom\simple_html_dom.php';
require_once 'sites.php';
require_once 'send_mail.php';
ini_set('display_errors','on');
foreach ($site_list as $name => $link){
$command = "C:\\Python27\\python C:\\webcheck\\webcheck.py -o C:\\wamp\\www\\cron\\reports\\$name $link";
$output = shell_exec($command);
$log_file = "C:\\wamp\\www\\cron\\log.txt";
$fh = fopen($log_file,'w') or die('can not open file');
fwrite($fh, $output);
fclose($fh);
}
/*Scan folder for reporting */
$path = 'C:\\wamp\\www\cron\\reports\\';
$msg = '';
foreach (new DirectoryIterator($path) as $fileInfo) {
if($fileInfo->isDir() && !$fileInfo->isDot()) {
// Do whatever
$webcheck = $fileInfo->getFilename() ;
$html = file_get_html($path.$webcheck.'\\badlinks.html');
$es = $html->find('div[class="content"]', 0);
$msg .="<h2>BADLINKS $webcheck</h2>";
$msg .= $es->innertext; // Some Content
}
}
$subj = $_subj;
$to = $_to;
$from = $_from;
$name = $_name;
if (smtpmailer($to, $from, $name, $subj, $msg)) {
echo 'Yeah, message send via Gmail';
} else {
if (!smtpmailer($to, $from, $name, $subj, $msg, false)) {
if (!empty($error)) echo $error;
} else {
echo 'Yep, the message is send (after doing some hard work)';
}
}
?>
但是有了这个cron.bat
C:\wamp\bin\php\php5.3.5\php C:\wamp\www\cron\cron.php
我去cmd
输入cron.bat
我收到消息Mail error: SMTP Connect() failed.
你有什么主意吗?
谢谢