会员登录 | 会员注册 | 意见建议 | 网站地图

站长资源综合门户

当前位置:首页 > 站长学院 > 编程程序 > 分享几个非常有用的PHP代码片段

分享几个非常有用的PHP代码片段

时间:2012-02-27 09:30:58   作者:   来源:   点击:

"br" => "whois.registro.br",

"bz" => "whois lizenic.bz",

"ca" => "whois.cira.ca",

"cc" => "whois.nic",

"ch" => "whois.nic.ch",

"cl" => "whois.nic.cl",

"cn" => "whoisnic ",

"cz" => "whois.nic.cz",

"de" => "whois.nic",

"fr" => "whois.nic.fr",

"hu" => "whois.nic.hu",

"ie" => "whois.domainregistry.ie",

"il" => "whois.isoc.il",

"in" => "whois.ncst.ernet.in",

"ir" => "whois.nic.ir",

"mc" => "whois.ripe ",

"to" => "whois.tonic.to",

"tv" => "whois",

"ru" => "whois.ripn ",

"org" => "whois.pir",

"aero" => "whoisrmation.aero",

"nl" => "whois.domain-registry.nl"

);

if (!isset($servers[$ext])){

die('Error: No matching nic server found!');

}

$nic_server = $servers[$ext];

$output = '';

// connect to whois server:

if ($conn = fsockopen ($nic_server, 43)) {

fputs($conn, $domain."rn");

while(!feof($conn)) {

$output .= fgets($conn,128);

}

fclose($conn);

}

else { die('Error: Could not connect to ' . $nic_server . '!'); }

return $output;

}

10. 通过Email发送PHP错误

// Our custom error handler

function nettuts_error_handler($number, $message, $file, $line, $vars){

$email = "

An error ($number) occurred on line

$line and in the file: $file.

$message

";

$email .= "

" . print_r($vars, 1) . "

";

$headers = 'Content-type: text/html; charset=iso-8859-1' . "rn";

// Email the error to someone...

error_log($email, 1, 'you@youremail', $headers);

// Make sure that you decide how to respond to errors (on the user's side)

分享到:

网友评论

热门编程程序