欢迎看看这个无聊的我的博客,可能真的很无聊的
RSS聚合
终于用上实验室的打印机了
在看过 Diablo 3 的 Trailer 之后
用 MEncoder 编码 H. 264 流
Adium 一些工作与开源软件相关的思考
最近在写的两个东西
State of iPhone Open Application Development (1)
How to crash your iTunes
关于几个我参与的项目
为何你不应该再用 “Hei”
变形金刚………………
另辟蹊径…………另,开签售会啦……
交规考试大揭秘……
选择综合症…………出行预告!
2008年8月8日,重大头条奥运新闻!
机不可失………………另,书展签售会预告!
Mar
20
3322.org动态域名用php的脚本解决
新件文件getip.php , 以下内容
getip.php
----------------------------------------------------------------------------------------------
#!/usr/local/bin/php -q
function openfile($file){
$theget="";
if($open=file($file)){
$count=count($open);
for($i=0;$i<$count;$i++){
$theget.=$open[$i];
}
}else{
die('读取数据错误');
}
return $theget;
}
function writelog($str)
{
$tmp="";
if($str !="")
{
// 日志文件路径 /usr/workhome/3322.org/getip.txt
$fp = @fopen("/usr/workhome/3322.org/getip.txt", "a+");
if($fp)
{
fwrite($fp, date("Y-m-d H:i:s").": ".$str."\n");
fclose($fp);
$tmp="ok";
}
}
return $tmp;
}
$str=openfile("http://用户名:密码@members.3322.org/dyndns/update?system=dyndns&hostname=域名");
//调试时使用
echo $str;
//写日志, 当然也可以不用,注释掉.
writelog($str)
?>
然后命令:
# chmod 755 getip.php
在定时任务里加上 getip.php的任务,设定十分钟一次.
可以在命令行里:
# ./getip.php
看看结果.
新件文件getip.php , 以下内容
getip.php
----------------------------------------------------------------------------------------------
#!/usr/local/bin/php -q
function openfile($file){
$theget="";
if($open=file($file)){
$count=count($open);
for($i=0;$i<$count;$i++){
$theget.=$open[$i];
}
}else{
die('读取数据错误');
}
return $theget;
}
function writelog($str)
{
$tmp="";
if($str !="")
{
// 日志文件路径 /usr/workhome/3322.org/getip.txt
$fp = @fopen("/usr/workhome/3322.org/getip.txt", "a+");
if($fp)
{
fwrite($fp, date("Y-m-d H:i:s").": ".$str."\n");
fclose($fp);
$tmp="ok";
}
}
return $tmp;
}
$str=openfile("http://用户名:密码@members.3322.org/dyndns/update?system=dyndns&hostname=域名");
//调试时使用
echo $str;
//写日志, 当然也可以不用,注释掉.
writelog($str)
?>
然后命令:
# chmod 755 getip.php
在定时任务里加上 getip.php的任务,设定十分钟一次.
可以在命令行里:
# ./getip.php
看看结果.




