???? ??? ?? ? ?? ?? ??? ?? ?? PHP ?? ??
Jul 25, 2016 am 08:57 AM
本文介紹下,用php獲取網(wǎng)站的地理位置,以及操作系統(tǒng)相關(guān)信息的一例代碼,有需要的朋友參考下。
1,php代碼部分 <?php /** * 獲取網(wǎng)站地理位置 * 獲取網(wǎng)站操作系統(tǒng)信息 * edit by bbs.it-home.org */ error_reporting(E_ERROR); header(“content-Type: text/html; charset=gb2312″); set_time_limit(120); $host = isset($_POST['url']) ? chop(str_replace(‘http://’,”,$_POST['url'])) : ‘ www.2cto.com ’; $port = isset($_POST['duankou']) ? chop($_POST['duankou']) : ’80′; $num = 10; function microtime_float() { list($usec, $sec) = explode(” “, microtime()); return ((float)$usec + (float)$sec); } function ip138($url) { $host = ‘www.ip138.com’; $fp = @fsockopen($host,80,&$errno,&$errstr,3); $get = “GET /ips.asp?ip=”.$url.” HTTP/1.1\r\nHost:”.$host.”\r\nConnection: Close\r\n\r\n”; @fputs($fp,$get); $data = ”; while ($fp && !feof($fp)) $data .= fread($fp, 1024); @fclose($fp); $s1 = ‘\<table width\=\”80\%\” border\=\”0\” align\=\”center”\ cellpadding\=\”0\” cellspacing\=\”0\”\>’; $s2 = ‘\<\/table\>’; $tmp = array(); preg_match_all(“/”.$s1.”([^~]*?)”.$s2.”/i”,$data,$tmp); $tmp1 = array(); preg_match_all(“/\<li\>([^~]*?)\<\/li\>/i”,$tmp[0][0],$tmp1); return $tmp1[0][0].$tmp1[0][1].$tmp1[0][2]; } function getsoft($host,$port) { $fp = @fsockopen($host,$port,&$errno,&$errstr,3); if(!$fp) return ‘unknown’; $get = “GET / HTTP/1.1\r\nHost:”.$host.”\r\nConnection: Close\r\n\r\n”; @fputs($fp,$get); $data = ”; while ($fp && !feof($fp)) $data .= fread($fp, 1024); @fclose($fp); $array = explode(“\n”,$data); $k = 2; for($i = 0;$i < 20;$i++) { if(stristr($array[$i],’Server’)){$k = $i; break;} } if(!stristr($array[$k],’Server’)) return ‘unknown’; else return str_replace(‘Server’,'服務(wù)器軟件’,$array[$k]); } function ping($host,$port) { $time_start = microtime_float(); $ip = gethostbyname($host); $fp = @fsockopen($host,$port,&$errno,&$errstr,1); if(!$fp) return ‘Request timed out.<br />’.”\r\n”; $get = “GET / HTTP/1.1\r\nHost:”.$host.”\r\nConnection: Close\r\n\r\n”; @fputs($fp,$get); @fclose($fp); $time_end = microtime_float(); $time = $time_end – $time_start; $time = ceil($time * 1000); return ‘Reply from ‘.$ip.’: time=’.$time.’ms<br />’; } if(isset($_POST['url']) && isset($_POST['duankou'])) { echo ip138($host).’<br /><br />’; echo ‘<font color=”#FF0000″>’.getsoft($host,$port).’</font><br /><br />’; echo ‘Pinging ‘.$host.’ ['.gethostbyname($host).'] with Port:’.$port.’ of data:<br /><br />’.”\r\n”; ob_flush(); flush(); for($i = 0;$i < $num;$i++) { echo ping($host,$port); ob_flush(); flush(); sleep(1); } } ?> 2,頁面內(nèi)容部分 <form method=”POST”> 域名/IP:<input type=”text” name=”url” value=”<?php echo $host;?>” size=”50″> 端口:<input type=”text” name=”duankou” value=”<?php echo $port;?>” size=”10″> <input type=”submit” value=”ping”> </form> >>> 您可能感興趣的文章: php新浪接口查詢ip地理位置 php騰訊ip分享計劃獲取IP地理位置 php通過IP獲取地理位置 PHP通過IP獲取地理位置的代碼 php通過IP獲取地理位置的實例參考 php 獲取用戶真實IP與地理位置(淘寶IP接口)的實現(xiàn)代碼 php根據(jù)IP地址獲取當(dāng)前地理位置接口 |

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2
