Home  >  Article  >  Backend Development  >  After the webmaster uses the PHP function to respond, there is a record in the IIS log. Check the iis log for Trojans. Iis error log. How to check the iis date.

After the webmaster uses the PHP function to respond, there is a record in the IIS log. Check the iis log for Trojans. Iis error log. How to check the iis date.

PHP中文网
PHP中文网Original
2016-07-29 08:49:191141browse

If you want to set the response of multiple websites, please set the maximum execution time. 120 seconds is enough to test more than 40 websites. If your company has many websites and you want to quickly know whether these websites are opening normally, the following code can help you.

<?php 
//设置最大执行时间是 120秒
ini_set('max_execution_time',120);
function httpcode($url){
	$ch = curl_init();
	$timeout = 3;
	curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($ch, CURLOPT_HEADER, 1);
	curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); 
	curl_setopt($ch,CURLOPT_URL,$url);
	curl_exec($ch);
	return $httpcode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
	curl_close($ch);  
}
$check_web = array('http://test1.onestopweb.cn/', 'http://test2.onestopweb.cn/', 'http://test3.onestopweb.cn/', 'http://www.onestopweb.cn/');
for($i=0;$i
使用方法:如果显示为200则正常,如果显示其它值表示不正常;$timeout后面的3是设置超时秒数。

After the PHP curl_setopt function responds, traces will be left in the IIS log. As the saying goes, DDOS distributed denial-of-service attacks are very popular now, and you can see some clues in the logs.

#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2016-05-14 01:58:42
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
2016-05-14 01:58:41 182.254.231.253 GET / - 80 - 182.254.231.238 - 200 0 0 124

The above introduces the IIS log record after the webmaster uses the PHP function to respond, including the IIS log and PHP content. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn