php 环信发送私信

	/***phpalapi接口:环信发送消息:通知发送私信*/
	//Easemob.class.php位置:/data/wwwroot/twjs.yunbaozhibo.com/api/public/Easemob.class.php
	public function sendHuanxinMsg($suid,$content){
		 //发送私信:环信*****************************************************************************
		include "./Easemob.class.php";
		$options['client_id']='YXA6QcGAQFMyEeeobPfK_z9yaw';
		$options['client_secret']='YXA66j64tXNMOhe-SOVzKQiWZQdhIhU';
		$options['org_name']='1181170617178219';
		$options['app_name']='zhengapp';
		
		$h=new \Easemob($options);
		/* $js= $h->getUser("12663");//测试是否联通
		file_put_contents('./huanxinp.txt',date('Y-m-d H:i:s').'提交参数信息 :'.json_encode($js)."\r\n",FILE_APPEND);
		 */
		if($suid){
			$users=explode(",",$suid);
		
			$count=count($users);
			$nums=ceil($count/100);
			for($i=0,$m=0;$i<$nums;$i++){
				$target=array();
				for($n=0;$n<100;$n++,$m++){
					if($m==$count){
						break;
					}
					$target[]=$users[$m];
				}
				try{
					//发送文本消息: from:1:系统消息
					$from='1';
					$target_type="users";
					//$target=array("1529","1527","1453");
					$ext['isfollow']=1;
					//**********************************正式投入放开下列代码*******************************************************************************
					/* $result=$h->sendText($from,$target_type,$target,$content,$ext); */
				
				}catch(Exception $e){
					file_put_contents('./huanxinp.txt',date('Y-m-d H:i:s').'提交参数信息 :'.json_encode($e)."\r\n",FILE_APPEND);
				}	 
			}
		}
	}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值