我想在我的网站内添加雅虎聊天图标。为了检测 ID 状态(在线/离线)并打开信使工具,我编写了下面的 PHP 代码(来自网站)。但它总是返回 ID 处于脱机状态。雅虎会阻止检查状态吗?有什么问题?
<?php
$yahoo_id = 'some_id';
$getstatus = file_get_contents('http://mail.opi.yahoo.com/online?u='.$yahoo_id.'&m=a&t=1');
switch($getstatus) {
case "00": $status = '<img src="images/yahoo_offline.png" />';
break;
case "01": $status = '<a href="ymsgr:sendIM?'.$yahoo_id.'"><img src="images/yahoo_online.png" /></a>';
break;
}
echo $status;
?>