(msn机器人)3分钟学会使用程式发送msn讯息,php篇(一)

msnSDK讯息控制开发套件 同时支援MSN/Yahoo即时通 讯息双向传递

ps.也请参考 msnSDK的使用流程

以下内容在http://rd-program.blogspot.com/2008/11/5msnphp.html 也有

msnSDK讯息控制开发套件 同时支援MSN/Yahoo即时通 讯息双向传递

ps.也请参考 msnSDK的使用流程

步骤一:取得api 使用的权限(GETSPID)

$file="http://59.120.234.84:8082/msnSDK/msn_cgi-win32?FUNC=GETSPID&USERID=apiblogt1&PASSWD=msnsdkt" ;
$myArray='';
$mySession='';
$myResult='';
$getline='';

if (!($fp = fopen($file, "r"))) {
die("could not open XML input");
}
while ($getline = fgets($fp, 4096)) {
$myArray=explode("\t",$getline);
$myResult=$myArray[0];
$mySession= $myArray[1];
}
fclose($fp);
if ($myResult=="0")
{
echo "get session fail...
";
exit();
}
else
{
//$_SESSION["mySession"]= $mySession;
echo "get session=".$mySession."
";
}
echo "<a href='REGISTER.php?uids=".$_GET["uids"]."&session=".$mySession."'>go register page</a>";
?>

步骤二: 邀请联络人(REGISTER)

$myArray='';
$mySession='';
$myResult='';
$getline='';
//register:
$file="http://59.120.234.84:8082/msnSDK/msn_cgi-win32?FUNC=REGISTER&uids=".$_GET["uids"]."&session=".$_GET["session"] ;
echo $file."
";

if (!($fp = fopen($file, "r"))) {
die("could not open XML input");
}
while ($getline = fgets($fp, 4096)) {
$myArray=explode("\t",$getline);
$myResult=$myArray[0];
}
fclose($fp);

if ($myResult=="0")
{
echo "register fail... ".$myArray[1]."
";
//exit();
}
else
{
echo "register ok. account=".$myArray[2]."
";
}
echo "<a href='SENDMSG.php?uids=".$_GET["uids"]."&msg=hello&encoding=utf-8&flags=0&session=".$_GET["session"]."'>go SENDMSG page</a>";
?>

步骤三:发送讯息(SENDMSG)

$myArray='';
$mySession='';
$myResult='';
$getline='';

//send message:
$file="http://59.120.234.84:8082/msnSDK/msn_cgi-win32?FUNC=SENDMSG&uids=".$_GET["uids"]."&msg=".$_GET["msg"]."&encoding=utf-8&flags=0&session=".$_GET["session"] ;
if (!($fp = fopen($file, "r"))) {
die("could not open XML input");
}
while ($getline = fgets($fp, 4096)) {
$myArray=explode("\t",$getline);
$myResult=$myArray[0];
}
fclose($fp);
if ($myResult=="0")
{
echo "send message fail... ".$myArray[1]."
";
exit();
}
else
{
echo "send message ok. message=".$myArray[2]."
";
}
?>

其他更详细的参数可以参考msnSDK讯息控制开发套件程式介面说明书


关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章