大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
// exec('mongoexport -h 192.168.6.97 --port 40000 -d fenjianlidb -c fenjianli -f "meta_info.file_path" -q "{\'create_time\':{\'$gte\': \'1487088000\',\'$lte\': \'1487644200\'}}" -o ' . $save_path .'middle.txt', $ret); //window平台
成都创新互联公司IDC提供业务:服务器托管机柜,成都服务器租用,服务器托管机柜,重庆服务器租用等四川省内主机托管与主机租用业务;数据中心含:双线机房,BGP机房,电信机房,移动机房,联通机房。
//php 执行
exec('mongoexport -h 192.168.6.97 --port 40000 -d zhengliangdb -c newzengliang -f "meta_info.file_path" -q \'{create_time:{$gte: 1487645408,$lte: 1487646251}}\' -o /data/work_time/work0221/testMid/middle.txt', $ret); //Linux 成功 (切记转移) mongoexport --help 查看
--------------------------------------测试代码-----------------------------------------
/**
* @Author: lixiaozhu
* @Date: 2016-09-21 12:51:55
* @Last Modified by: lixiaozhu
* @Last Modified time: 2017-01-20 18:50:24
*/
set_time_limit(0);
// $save_path = 'D:/phpStudy/WWW/test01/mongo/test0221/';
$save_path = '/data/work_time/work0221/testMid/';
//中间件
// exec('mongoexport -h 192.168.6.97 --port 40000 -d fenjianlidb -c fenjianli -f "meta_info.file_path" -q "{\'create_time\':{\'$gte\': \'1487088000\',\'$lte\': \'1487644200\'}}" -o ' . $save_path .'middle.txt', $ret); //window平台
//php 执行
exec('mongoexport -h 192.168.6.97 --port 40000 -d zhengliangdb -c newzengliang -f "meta_info.file_path" -q \'{create_time:{$gte: 1487645408,$lte: 1487646251}}\' -o /data/work_time/work0221/testMid/middle.txt', $ret); //Linux 成功
$groups = array(
'group1' => 'http://192.168.6.49/',
'group2' => 'http://192.168.6.50/',
);
$content = file_get_contents($save_path . 'middle.txt');
$list = preg_split('/\s+/', $content);
$prefix = date('YmdH');
foreach ($list as $key => $item) {
echo $key++, PHP_EOL;
$item = json_decode($item, true);
$file_path = trim($item['meta_info']['file_path']);
$group = substr($file_path, 0, 6);
if (isset($groups[$group])) {
$url = $groups[$group] . $file_path;
$content = file_get_contents($url);
if(false !== strpos($content,'zhaopin.com')){ //可能会有 zhaopin.cn localhost/qiaoda/zhilian/z1.html
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_zhilian.txt');
} elseif (false !== strpos($content,'51job.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_51job.txt');
} elseif (false !== strpos($content,'liepin.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_liepin.txt');
} elseif (false !== strpos($content,'ganji.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_ganji.txt');
} elseif (false !== strpos($content, '58.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_58tongchen.txt');
} elseif (false !== strpos($content, 'chinahr.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_YCjianli.txt');
} else {
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_other.txt');
}
} else {
echo 'mubanFileError';
error_log($file_path . PHP_EOL, 3, $save_path . $prefix . '_mubanFileError.txt');
}
unset($content);
}