跳转QQ名片强制加好友PHP接口源码
想要添加别人的QQ号码,但是搜索不到怎么办?如果别人隐藏了QQ号码,不允许被搜索添加,我们该如何加到对方的QQ呢?今天我就分享一个PHP接口源码,只需几十行代码就能实现免费跳转QQ名片加好友的功能。这个接口PHP源码可以免费在线下载,并且根据系统底层版本特性使用不同的mqq和腾讯QQ官方的API!
调用实例:(保存的文件名).php?qq=(需要跳转的qq)
<?phpheader('Content-Type:application/json; charset=utf-8');$agent = strtolower($_SERVER['HTTP_USER_AGENT']);//url 参数 ?qq=123456789$qq = isset($_GET['qq']) ? $_GET['qq'] : "";if(empty($qq)){echo json_encode(array('code'=>201,'msg'=>'QQ不能为空'),480);}elseif(!preg_match("/^[1-9][0-9]{4,10}$/",$qq)){echo json_encode(array('code'=>202,'msg'=>'QQ格式不正确'),480);}elseif(strpos($agent,'windows nt')){$loca = "tencent://ContactInfo/?subcmd=ViewInfo&puin=0&uin={$qq}";}elseif(strpos($agent,'iphone')){$loca = "mqq://im/chat?chat_type=wpa&uin={$qq}&version=1&src_type=web";}elseif(strpos($agent,'android')){$loca = "mqq://card/show_pslcard?src_type=internal&version=1&uin={$qq}&card_type=person&source=sharecard";}if(empty($loca)==false){header("Location:$loca");exit;}?><?php header('Content-Type:application/json; charset=utf-8'); $agent = strtolower($_SERVER['HTTP_USER_AGENT']); //url 参数 ?qq=123456789 $qq = isset($_GET['qq']) ? $_GET['qq'] : ""; if(empty($qq)){ echo json_encode(array('code'=>201,'msg'=>'QQ不能为空'),480); }elseif(!preg_match("/^[1-9][0-9]{4,10}$/",$qq)){ echo json_encode(array('code'=>202,'msg'=>'QQ格式不正确'),480); }elseif(strpos($agent,'windows nt')){ $loca = "tencent://ContactInfo/?subcmd=ViewInfo&puin=0&uin={$qq}"; }elseif(strpos($agent,'iphone')){ $loca = "mqq://im/chat?chat_type=wpa&uin={$qq}&version=1&src_type=web"; }elseif(strpos($agent,'android')){ $loca = "mqq://card/show_pslcard?src_type=internal&version=1&uin={$qq}&card_type=person&source=sharecard"; } if(empty($loca)==false){ header("Location:$loca"); exit; } ?><?php header('Content-Type:application/json; charset=utf-8'); $agent = strtolower($_SERVER['HTTP_USER_AGENT']); //url 参数 ?qq=123456789 $qq = isset($_GET['qq']) ? $_GET['qq'] : ""; if(empty($qq)){ echo json_encode(array('code'=>201,'msg'=>'QQ不能为空'),480); }elseif(!preg_match("/^[1-9][0-9]{4,10}$/",$qq)){ echo json_encode(array('code'=>202,'msg'=>'QQ格式不正确'),480); }elseif(strpos($agent,'windows nt')){ $loca = "tencent://ContactInfo/?subcmd=ViewInfo&puin=0&uin={$qq}"; }elseif(strpos($agent,'iphone')){ $loca = "mqq://im/chat?chat_type=wpa&uin={$qq}&version=1&src_type=web"; }elseif(strpos($agent,'android')){ $loca = "mqq://card/show_pslcard?src_type=internal&version=1&uin={$qq}&card_type=person&source=sharecard"; } if(empty($loca)==false){ header("Location:$loca"); exit; } ?>
Little compliments mean so much to me sometimes.
有时候,一点微不足道的肯定,对我却意义非凡
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容