function scanUrl($httpUrl, $toTitle, $codeset) { $splStr = ''; $i = ''; $s = ''; $content = ''; $PubAHrefList = ''; $PubATitleList = ''; $splUrl = ''; $spltitle = ''; $title = ''; $url = ''; $htmlDir = ''; $htmlFilePath = ''; $nOK = ''; $dataArray = ''; $webState = ''; $u = ''; $iniDir = ''; $iniFilePath = ''; $websize = ''; $nSetTime = ''; $startTime = ''; $openSpeed = ''; $isLocal = ''; $isThrough = ''; $htmlDir = '/../网站UrlScan/' . setFileName(getWebSite($httpUrl)); CreateDirFolder($htmlDir); $htmlFilePath = $htmlDir . '/' . setFileName($httpUrl) . '.html'; $iniDir = $htmlDir . '/conifg'; CreateFolder($iniDir); $iniFilePath = $iniDir . '/' . setFileName($httpUrl) . '.txt'; //httpurl="http://maiside.net/" $webState = 0; $nSetTime = 1; $openSpeed = 0; if (CheckFile($htmlFilePath) == false) { $startTime = now(); aspEcho('codeset', $codeset); $dataArray = handleXmlGet($httpUrl, $codeset); $content = $dataArray[0]; $content = toGB2312Char($content); //给PHP用,转成gb2312字符 $webState = $dataArray[1]; $openSpeed = dateDiff('s', $startTime, now()); //content=gethttpurl(httpurl,codeset) //call createfile(htmlFilePath,content) WriteToFile($htmlFilePath, $content, $codeset); createFile($iniFilePath, $webState . vbCrlf() . $openSpeed); $nSetTime = 3; $isLocal = 0; } else { //content=getftext(htmlFilePath) $content = reaFile($htmlFilePath, $codeset); $content = toGB2312Char($content); //给PHP用,转成gb2312字符 $splStr = aspSplit(getFText($iniFilePath), vbCrlf()); $webState = CInt($splStr[0]); $openSpeed = CInt($splStr[0]); $isLocal = 1; } $websize = getFSize($htmlFilePath); if ($websize == '') { $websize = 0; } aspEcho('isLocal', $isLocal); $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'weburlscan where httpurl=\'' . $httpUrl . '\''); if (@mysql_num_rows($rsObj) == 0) { $rs = mysql_fetch_array($rsObj); connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'weburlscan(httpurl,title,charset) values(\'' . $httpUrl . '\',\'' . $toTitle . '\',\'' . $codeset . '\')'); } connexecute('update ' . $GLOBALS['db_PREFIX'] . 'weburlscan set webstate=' . $webState . ',websize=' . $websize . ',openspeed=' . $openSpeed . ',charset=\'' . $codeset . '\' where httpurl=\'' . $httpUrl . '\''); //strLen(content) 不用这个,不精准 $s = getContentAHref('', $content, $PubAHrefList, $PubATitleList); $s = handleScanUrlList($httpUrl, $s); //call echo("httpurl",httpurl) //call echo("s",s) //call echo("PubATitleList",PubATitleList) $nOK = 0; $splUrl = aspSplit($PubAHrefList, vbCrlf()); $spltitle = aspSplit($PubATitleList, vbCrlf()); for ($i = 1; $i <= uBound($splUrl); $i++) { $title = $spltitle[$i]; $url = $splUrl[$i]; //去掉#号后台的字符20160506 if (inStr($url, '#') > 0) { $url = mid($url, 1, inStr($url, '#') - 1); } if ($url == '') { if ($title != '') { aspEcho('网址为空', $title); } } else { $url = handleScanUrlList($httpUrl, $url); $url = handleWithWebSiteList($httpUrl, $url); if ($url != '') { $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'weburlscan where httpurl=\'' . $url . '\''); if (@mysql_num_rows($rsObj) == 0) { $rs = mysql_fetch_array($rsObj); $u = lCase($url); if (inStr($u, 'tools/downfile.asp') > 0 || inStr($u, '/url.asp?') > 0 || inStr($u, '/aspweb.asp?') > 0 || inStr($u, '/phpweb.php?') > 0 || $u == 'http://www.maiside.net/qq/' || inStr($u, 'mailto:') > 0 || inStr($u, 'tel:') > 0 || inStr($u, '.html?replytocom') > 0) { //.html?replytocom 王通网站 $isThrough = 0; } else { $isThrough = 1; //不用true 因为写入数据会有问题 } connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'weburlscan(tohttpurl,totitle,httpurl,title,isthrough,charset) values(\'' . $httpUrl . '\',\'' . $toTitle . '\',\'' . $url . '\',\'' . left($title, 255) . '\',' . $isThrough . ',\'' . $codeset . '\')'); $nOK = $nOK + 1; aspEcho($i, $url); } else { aspEcho($title, $url); } } } } $scanUrl = $nSetTime; return @$scanUrl; }
function getFileText($file) { return reaFile($file); }