php curl模拟qq发送信息

今天没事瞎捣鼓,用curl模拟实现了发送qq与留言功能。比较简单。这里从3gqq入手,缘由是3gqq只用验证sid。这样操做起来比较简单。php

直接上代码吧。,。html

一,发送qq给某人curl

 1 <?php
 2     header("Content-type:text/html;charset=utf-8");
 3     $ch = curl_init();
 4     curl_setopt ($ch, CURLOPT_URL, "http://q16.3g.qq.com/g/s?sid=你的sid"); //发贴地址
 5     curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
 6     curl_setopt($ch, CURLOPT_POST,true); //设置POST方式
 7     curl_setopt($ch, CURLOPT_POSTFIELDS,"u=630803889&saveUrl=0&do=send&on=1&aid=发送&msg=你好,测试");//发送的post值
 8     $file_contents = curl_exec($ch);//得到返回值
 9     curl_close($ch);
10 ?>

二,给某人留言jsp

 1 <?php
 2     header("Content-type:text/html;charset=utf-8");
 3     $ch = curl_init();
 4     curl_setopt ($ch, CURLOPT_URL, "http://blog60.z.qq.com/mmsgb/add_msg_action_switch.jsp?B_UID=630803889&amp;sid=你的sid"); //发贴地址
 5     curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
 6     curl_setopt($ch, CURLOPT_POST,true); //设置POST方式
 7     curl_setopt($ch, CURLOPT_POSTFIELDS,"entry=board&ispostmsg=1&msg=你好,测试");//发送的post值
 8     $file_contents = curl_exec($ch);//得到返回值
 9     curl_close($ch);
10 ?>

这两个功能虽简单,可是扩展开来仍是有不少用处的,好比第一个用在商城的下单提醒,用户下单后就直接发qq消息通知你。至于第二个稍微改下就能够作刷qq空间留言程序了。。post

相关文章
相关标签/搜索