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

站长资源综合门户

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

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

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

sed turpis tempor luctus. Curabitur sed nibh eu elit

mollis congue. Praesent ipsum diam, consectetur vitae

ornare a, aliquam a nunc. In id magna pellentesque

tellus posuere adipiscing. Sed non mi metus, at lacinia

augue. Sed magna nisi, ornare in mollis in, mollis

sed nunc. Etiam at justo in leo congue mollis.

Nullam in neque eget metus hendrerit scelerisque

eu non enim. Ut malesuada lacus eu nulla bibendum

id euismod urna sodales. ";

$compressed = gzcompress($string);

echo "Original size: ". strlen($string)."n";

/* prints

Original size: 800

*/

echo "Compressed size: ". strlen($compressed)."n";

/* prints

Compressed size: 418

*/

// getting it back

$original = gzuncompress($compressed);

9. 使用PHP做Whois检查

function whois_query($domain) {

// fix the domain name:

$domain = strtolower(trim($domain));

$domain = preg_replace('/^http:///i', '', $domain);

$domain = preg_replace('/^/i', '', $domain);

$domain = explode('/', $domain);

$domain = trim($domain[0]);

// split the TLD from domain name

$_domain = explode('.', $domain);

$lst = count($_domain)-1;

$ext = $_domain[$lst];

// You find resources and lists

// like these on wikipedia:

//

// http://de pedia/wiki/Whois

//

$servers = array(

"biz" => "whois.neulevel",

"com" => "whois.internic ",

"us" => "whois.nic.us",

"coop" => "whois.nic.coop",

"info" => "whois.nic",

"name" => "whois.nic",

"net" => "whois.internic ",

"gov" => "whois.nic.gov",

"edu" => "whois.internic ",

"mil" => "rs.internic ",

"int" => "whois.iana",

"ac" => "whois.nic.ac",

"ae" => "whois.uaenic.ae",

"at" => "whois.ripe ",

"au" => "whois.aunic ",

"be" => "whois.dns ",

"bg" => "whois.ripe ",

分享到:

网友评论

热门编程程序