php发送短信(调用阿里大鱼接口)

调用阿里大鱼接口,实现短信发送

        // $msg = "{\"name\":\"{$o_booking}\",\"orderid\":\"{$ordercode}\"}";
	// $this->sendsms($o_telephone,$msg);//发送短信
	//发送短信
	function sendsms($phone,$param,$extend='1001',$signname='xxx',$temp='SMS_xxx'){
		header("Content-Type:text/html; charset=utf-8");
		vendor('taobaosdk.TopSdk');
		$c = new \TopClient;
		$c->appkey = 'xxx';
		$c->secretKey = 'xxx';
		$req = new \AlibabaAliqinFcSmsNumSendRequest;
		$req->setExtend($extend);//用户可以传入自己下级的会员ID
		$req->setSmsType("normal");
		$req->setSmsFreeSignName($signname);
		$req->setSmsParam($param);
		$req->setRecNum($phone);
		$req->setSmsTemplateCode($temp);
		$resp = $c->execute($req);
		$xml = $resp;
		$err_code = (string) $xml->result->err_code;
		$model = (string) $xml->result->model;
		$success = (string) $xml->result->success;		
	}


你可能感兴趣的:(代码实现)