• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ihttp_post函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ihttp_post函数的典型用法代码示例。如果您正苦于以下问题:PHP ihttp_post函数的具体用法?PHP ihttp_post怎么用?PHP ihttp_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ihttp_post函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_authtoken

 public function get_authtoken($node, $openid)
 {
     $data = array('api_id' => $this->module['config']['authid'], 'api_key' => $this->module['config']['authkey'], 'node' => $node, 'openid' => $openid);
     $auth_token = ihttp_post($this->get_auth_token, json_encode($data));
     $auth_token = json_decode($auth_token['content'], true);
     return $auth_token;
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:7,代码来源:processor.php


示例2: receive

 public function receive()
 {
     global $_W;
     $type = $this->message['type'];
     //这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看WORMWOOD文档来编写你的代码
     if ($type != "text" && $type != "image" && $type != "voice") {
         return;
     }
     $file = IA_ROOT . '/source/modules/mechat/function.php';
     if (!file_exists($file)) {
         return array();
     }
     include_once $file;
     $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
     $row = pdo_fetch($sql, array(':weid' => $_W['weid']));
     if ($row) {
         $pdata = array("ToUserName" => $this->message['tousername'], "FromUserName" => $this->message['fromusername'], "CreateTime" => $this->message['createtime'], "MsgType" => $this->message['msgtype'], "Content" => $this->message['content'], "MsgId" => $this->message['msgid']);
         if ($type == "voice") {
             $pdata["MsgType"] = "text";
             $pdata["Content"] = "系统:微信公众号粉丝发送语音消息,系统暂不能接收请客服处理。";
         }
         $dat = array('unit' => $row["name"], 'msg' => json_encode($pdata));
         $dat2 = iunserializer($row["cdata"]);
         $actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $dat2["access_token"], "appid" => $dat2["appid"], "appsecret" => $dat2["appsecret"]));
         $url = sprintf($this->gateway['mechat_receive'], $actoken);
         $content = ihttp_post($url, $dat);
     }
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:28,代码来源:receiver.php


示例3: xiaojo

 private function xiaojo()
 {
     $data = array('chat' => $this->message['content'] . "^" . time(), 'db' => $this->module['config']['xjdb'], 'pw' => $this->module['config']['xjpw'], 'from' => $this->message['from'], 'to' => $this->message['to']);
     $api = "http://www.xiaojo.com/api5.php";
     $data = ihttp_post($api, $data);
     return $data;
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:7,代码来源:processor.php


示例4: GetRouterInter

 private function GetRouterInter($jktype, $postarr)
 {
     $arrResult = array('flag' => 0, 'result' => '', 'token' => '', 'debug' => '');
     $url = $this->jk_url[$jktype];
     $jsnpostarr = json_encode($postarr);
     load()->func('communication');
     $rsp = ihttp_post($url, $jsnpostarr);
     $dat = $rsp['content'];
     //获取接口情况
     if (!empty($dat)) {
         $result = json_decode($dat, true);
         if (!is_array($result)) {
             $arrResult['flag'] = 0;
             $arrResult['result'] = '接口返回参数不是JSON格式';
             $arrResult['debug'] = $dat;
         } else {
             if ($result[$this->jk_ret_par[$jktype][0]] == 0) {
                 $arrResult['flag'] = 1;
                 $arrResult['result'] = $result[$this->jk_ret_par[$jktype][1]];
             } elseif ($result[$this->jk_ret_par[$jktype][0]] < 0) {
                 $arrResult['flag'] = -1;
                 $arrResult['result'] = $this->errcodetrans($result[$this->jk_ret_par[$jktype][2]]);
                 $arrResult['debug'] = $jsnpostarr;
             } else {
                 $arrResult['flag'] = 0;
                 $arrResult['result'] = '返回状态异常,请联系路由器接口提供方';
             }
         }
     } else {
         $arrResult['flag'] = 0;
         $arrResult['result'] = '接口无响应';
         $arrResult['debug'] = $url;
     }
     return $arrResult;
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:35,代码来源:processor.php


示例5: getnode_info

 public function getnode_info($node)
 {
     $node = intval($node);
     $data = array('api_id' => $this->module['config']['nodeid'], 'api_key' => $this->module['config']['nodekey'], 'node' => $node);
     $item = ihttp_post($this->retrieve_node, json_encode($data));
     $item = json_decode($item['content'], true);
     return $item;
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:8,代码来源:module.php


示例6: menuCreate

 public function menuCreate($menu)
 {
     $dat = json_encode($menu);
     $dat = urldecode($dat);
     $token = $this->fetch_token();
     $url = "https://api.yixin.im/cgi-bin/menu/create?access_token={$token}";
     $content = ihttp_post($url, $dat);
     return $this->menuResponseParse($content);
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:9,代码来源:yixin.account.class.php


示例7: doDisplay

 public function doDisplay()
 {
     //这个操作被定义用来呈现主导航栏上扩展菜单,每个模块只能呈现一个扩展菜单,有更多选项,请在页面内使用标签页来表示
     global $_W, $_GPC;
     $mechat = array();
     if (checksubmit('submit')) {
         $file = IA_ROOT . '/source/modules/mechat/function.php';
         if (!file_exists($file)) {
             return array();
         }
         include_once $file;
         $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
         $row = pdo_fetch($sql, array(':weid' => $_W['weid']));
         if ($row) {
             $dat = iunserializer($row["cdata"]);
             $pass = $dat["pass"];
             if ($_GPC['mechat-pass'] != $pass) {
                 $pass = md5($_GPC['mechat-pass']);
             }
             $mechat = array("name" => $_GPC['mechat-user'], "pass" => $pass, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']);
             $access_token = array("token" => $dat["access_token"]["token"], "expire" => $dat["access_token"]["expire"]);
             $update = array("name" => $_GPC['mechat-user'], "cdata" => iserializer($mechat), "access_token" => $access_token);
             pdo_update($this->tablename, $update, array('weid' => $_W['weid']));
         } else {
             $pass = md5($_GPC['mechat-pass']);
             $mechat = array("name" => $_GPC['mechat-user'], "pass" => $pass, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']);
             $access_token = array("token" => "", "expire" => "");
             pdo_insert($this->tablename, array("weid" => $_W['weid'], "name" => $_GPC['mechat-user'], "cdata" => iserializer($mechat), "access_token" => $access_token, "createtime" => TIMESTAMP));
         }
         //exit(json_encode($_W));
         $dat = array("unit" => $_GPC['mechat-user'], "password" => $pass, "wxAppid" => $_W['account']['key'], "wxAppsecret" => $_W['account']['secret']);
         $actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $access_token, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']));
         $url = sprintf("http://open.mobilechat.im/cgi-bin/weixin/bind?access_token=%s", $actoken);
         $content = ihttp_post($url, $dat);
         $dat2 = $content['content'];
         $result = @json_decode($dat2, true);
         if ($result["errcode"] == "0") {
             message('恭喜,微信服务号与美洽企业帐号绑定成功!', create_url('index/module/display', array('name' => 'mechat')), 'success');
         } else {
             message("微信服务号与美洽企业帐号绑定错误. <br />参数: " . json_encode($dat) . "<br />错误代码为: {$result['errcode']} <br />错误信息为: {$result['errmsg']}");
         }
     }
     $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
     $row = pdo_fetch($sql, array(':weid' => $_W['weid']));
     if ($row) {
         $mechat["name"] = $row["name"];
         $dat = iunserializer($row["cdata"]);
         $mechat["pass"] = $dat["pass"];
         $mechat["appid"] = $dat["appid"];
         $mechat["appsecret"] = $dat["appsecret"];
     }
     include $this->template('display');
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:53,代码来源:module.php


示例8: notify

 private function notify($params)
 {
     $access = $this->fetchAccess();
     $url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access;
     $params = json_encode($params);
     $content = ihttp_post($url, $params);
     if (is_error($content)) {
         return $content;
     } else {
         return @json_decode($content['content'], true);
     }
 }
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:12,代码来源:MicrobCore.class.php


示例9: Seed_tmplmsg

 public function Seed_tmplmsg($openid, $tmplmsgid, $rid, $params)
 {
     global $_W;
     $reply = pdo_fetch("select title,starttime,endtime FROM " . tablename("stonefish_bigwheel_reply") . " where rid = :rid", array(':rid' => $rid));
     $exchange = pdo_fetch("select awardingstarttime,awardingendtime FROM " . tablename("stonefish_bigwheel_exchange") . " where rid = :rid", array(':rid' => $rid));
     $listtotal = pdo_fetchcolumn("select xuninum+fansnum as total from " . tablename("stonefish_bigwheel_reply") . " where rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     $tmplmsg = pdo_fetch("select * FROM " . tablename("stonefish_bigwheel_tmplmsg") . " where id = :id", array(':id' => $tmplmsgid));
     $fans = pdo_fetch("select * FROM " . tablename("stonefish_bigwheel_fans") . " where rid = :rid and from_user = :from_user", array(':rid' => $rid, ':from_user' => $openid));
     $fans['realname'] = empty($fans['realname']) ? stripcslashes($fans['nickname']) : $fans['realname'];
     if (!empty($tmplmsg)) {
         if ($params['do'] == 'index') {
             $appUrl = $this->createMobileUrl('entry', array('rid' => $rid, 'entrytype' => 'index'), true);
         } else {
             $appUrl = $this->createMobileUrl($params['do'], array('rid' => $rid), true);
         }
         $appUrl = $_W['siteroot'] . 'app/' . substr($appUrl, 2);
         $str = array('#活动名称#' => $reply['title'], '#参与人数#' => $listtotal, '#活动时间#' => date('Y-m-d H:i', $reply['starttime']) . '至' . date('Y-m-d H:i', $reply['endtime']), '#兑奖时间#' => date('Y-m-d H:i', $exchange['awardingstarttime']) . '至' . date('Y-m-d H:i', $exchange['awardingendtime']), '#奖品名称#' => $params['prizerating'] . '-' . $params['prizename'], '#粉丝昵称#' => stripcslashes($fans['nickname']), '#真实姓名#' => $fans['realname'], '#现在时间#' => date('Y-m-d H:i', time()), '#奖品数量#' => $params['prizenum']);
         $datas['first'] = array('value' => strtr($tmplmsg['first'], $str), 'color' => $tmplmsg['firstcolor']);
         for ($i = 1; $i <= 10; $i++) {
             if (!empty($tmplmsg['keyword' . $i]) && !empty($tmplmsg['keyword' . $i . 'code'])) {
                 $datas[$tmplmsg['keyword' . $i . 'code']] = array('value' => strtr($tmplmsg['keyword' . $i], $str), 'color' => $tmplmsg['keyword' . $i . 'color']);
             }
         }
         $datas['remark'] = array('value' => strtr($tmplmsg['remark'], $str), 'color' => $tmplmsg['remarkcolor']);
         $data = json_encode($datas);
         load()->func('communication');
         load()->classs('weixin.account');
         $accObj = WeixinAccount::create($_W['acid']);
         $access_token = $accObj->fetch_token();
         if (empty($access_token)) {
             return;
         }
         $postarr = '{"touser":"' . $openid . '","template_id":"' . $tmplmsg['template_id'] . '","url":"' . $appUrl . '","topcolor":"' . $tmplmsg['topcolor'] . '","data":' . $data . '}';
         $res = ihttp_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token, $postarr);
         //添加消息发送记录
         $tmplmsgdata = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'from_user' => $openid, 'tmplmsgid' => $tmplmsgid, 'tmplmsg' => $postarr, 'createtime' => TIMESTAMP);
         pdo_insert('stonefish_bigwheel_fanstmplmsg', $tmplmsgdata);
         //添加消息发送记录
         return true;
     }
     return;
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:42,代码来源:site.php


示例10: submitNotify

 private function submitNotify()
 {
     $access = $this->core->fetchAccess();
     $pars = array();
     $pars['order_id'] = $this->message['orderid'];
     $url = "https://api.weixin.qq.com/merchant/order/getbyid?access_token={$access}";
     $content = ihttp_post($url, json_encode($pars));
     if (!is_error($content)) {
         $trade = @json_decode($content['content'], true);
         if (is_array($trade) && $trade['errcode'] == '40001') {
             $access = $this->core->fetchAccess(true);
             $url = "https://api.weixin.qq.com/merchant/order/getbyid?access_token={$access}";
             $content = ihttp_post($url, json_encode($pars));
             if (!is_error($content)) {
                 $trade = @json_decode($content['content'], true);
             }
         }
         if (is_array($trade) && $trade['errcode'] == '0') {
             $trade = $this->convertTrade($trade['order']);
             $ret = $this->core->submitNotify($this->message['from'], $trade);
             print_r($ret);
         }
     }
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:24,代码来源:processor.php


示例11: sendtempmsg

 public function sendtempmsg($template_id, $url, $data, $topcolor)
 {
     global $_W, $_GPC;
     //取TOKEN
     $from_user = $this->getFromUser();
     //	$tokens= $this->get_weixin_token();
     $tokens = $this->get_weixin_token();
     if (empty($tokens)) {
         return;
     }
     //
     $postarr = '{"touser":"' . $from_user . '","template_id":"' . $template_id . '","url":"' . $url . '","topcolor":"' . $topcolor . '","data":' . $data . '}';
     $res = ihttp_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $tokens, $postarr);
     //$res = $res['content'];
     //		$res = $res['content'];
     //		$res = json_decode($res, true);
     return true;
 }
开发者ID:noikiy,项目名称:mygit,代码行数:18,代码来源:site.php


示例12: pdo_insertid

            $id = pdo_insertid();
        } else {
            pdo_update("xcommunity_announcement", $data, array('id' => $id, 'weid' => $_W['weid']));
        }
        //是否启用模板消息
        if ($_GPC['status'] == 2) {
            load()->classs('weixin.account');
            load()->func('communication');
            $obj = new WeiXinAccount();
            $access_token = $obj->fetch_available_token();
            $templates = pdo_fetch("SELECT * FROM" . tablename('xcommunity_notice_setting') . "WHERE uniacid='{$_W['uniacid']}'");
            $key = 'template_id_' . $_GPC['enable'];
            $template_id = $templates[$key];
            $openids = pdo_fetchall("SELECT openid FROM" . tablename('xcommunity_member') . "WHERE weid='{$_W['uniacid']}' AND regionid='{$member['regionid']}'");
            $url = $_W['siteroot'] . "app/index.php?i={$_W['uniacid']}&c=entry&id={$id}&op=detail&do=announcement&m=xfeng_community";
            foreach ($openids as $key => $value) {
                $data = array('touser' => $value['openid'], 'template_id' => $template_id, 'url' => $url, 'topcolor' => "#FF0000", 'data' => array('first' => array('value' => $_GPC['title']), 'time' => array('value' => $_GPC['datetime']), 'location' => array('value' => $_GPC['location']), 'reason' => array('value' => $_GPC['reason']), 'remark' => array('value' => $_GPC['remark'])));
                $json = json_encode($data);
                $url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token;
                $ret = ihttp_post($url, $json);
            }
        }
        message('提交成功', $this->createMobileUrl('announcement', array('op' => 'display')), 'success');
    }
} elseif ($op == 'verify') {
    //公告状态
    $status = $_GPC['status'];
    pdo_query("update" . tablename("xcommunity_announcement") . " set status='{$status}' where id =:id and weid=:weid", array(':id' => $id, ':weid' => $_W['weid']));
    message('操作成功', referer(), 'success');
}
include $this->template('announcement');
开发者ID:guohuadeng,项目名称:wuyeWq,代码行数:31,代码来源:announcement.inc.php


示例13: date

 } else {
     if ($op == 'download') {
         $tmpdir = IA_ROOT . '/addons/ewei_shop/' . date('ymd');
         $f = file_get_contents($tmpdir . '/file.txt');
         $upgrade = json_decode($f, true);
         $files = $upgrade['files'];
         $auth = $this->getAuthSet();
         $path = "";
         foreach ($files as $f) {
             if (empty($f['download'])) {
                 $path = $f['path'];
                 break;
             }
         }
         if (!empty($path)) {
             $resp = ihttp_post(EWEI_SHOP_AUTH_URL, array('type' => 'download', 'ip' => $auth['ip'], 'id' => $auth['id'], 'code' => $auth['code'], 'domain' => $auth['domain'], 'path' => $path));
             $ret = @json_decode($resp['content'], true);
             if (is_array($ret)) {
                 $path = $ret['path'];
                 $dirpath = dirname($path);
                 if (!is_dir(IA_ROOT . '/addons/ewei_shop/' . $dirpath)) {
                     mkdirs(IA_ROOT . '/addons/ewei_shop/' . $dirpath, '0777');
                 }
                 $content = base64_decode($ret['content']);
                 file_put_contents(IA_ROOT . '/addons/ewei_shop/' . $path, $content);
                 $success = 0;
                 foreach ($files as &$f) {
                     if ($f['path'] == $path) {
                         $f['download'] = 1;
                         break;
                     }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:31,代码来源:upgrade.php


示例14: destroy_card

 private function destroy_card($content)
 {
     // 获取公众号的 access_token
     load()->classs('weixin.account');
     $access_token = WeiXinAccount::fetch_available_token();
     // 生成post请求的url地址
     $url = 'https://api.weixin.qq.com/card/code/consume?access_token=' . $access_token;
     // post请求的内容
     $posts = '{"code":' . $content . '}';
     // 加载文件: load()→func('communication')
     load()->func('communication');
     // 向处理卡券的模块提交post请求,并返回数据,可以尝试对结果打印
     $result = ihttp_post($url, $posts);
     // print_r($result);
     // 对返回的数据中的['content']进行json_decode处理
     $res = json_decode($result['content'], true);
     // 获取返回的错误码
     $errcode = $res["errcode"];
     // 获取返回的card_id
     $card_id = $res["card_id"];
     // 根据返回的错误码进行相应的处理
     switch ($errcode) {
         case '0':
             $message = '消费成功!卡券信息为:' . $this->reply_kaquanDetail($card_id);
             break;
         case '40099':
             $message = '该卡券已经被销毁!请重新输入' . $str . '进行销卡';
             break;
         case '40078':
             $message = '不合法的卡券状态!请重新输入“销卡”进行销卡';
             break;
         default:
             $message = '出现错误,无法销毁!请重新输入“销卡”进行销卡';
             break;
     }
     $this->endContext();
     // 返回消息内容
     return $this->respText($message);
 }
开发者ID:hanxiansen,项目名称:vh_xiaoka,代码行数:39,代码来源:processor.php


示例15: array

     $url = "https://api.weixin.qq.com/shakearound/page/delete?access_token={$token}";
     $pars = array();
     $pars['page_ids'][0] = intval($id);
     $resp = ihttp_post($url, json_encode($pars));
     if (is_error($resp)) {
         return $resp;
     }
     $ret = @json_decode($resp['content'], true);
     if (is_array($ret) && $ret['errcode'] == '0') {
         return true;
     }
     return error(-1, $resp['content']);
 }
 /**
  * 上传图片素材
  * @param $file string 要上传的文件
  * @return string
  */
 public function mediaUpload($file)
 {
     $file = IA_ROOT . '/attachment/' . $file;
     $token = $this->getAccessToken();
     $url = "https://api.weixin.qq.com/shakearound/material/add?access_token={$token}";
     $body = array();
     if (function_exists('curl_file_create')) {
         $body['media'] = curl_file_create($file);
     } else {
         $body['media'] = '@' . $file;
     }
     $resp = @ihttp_request($url, $body);
     if (is_error($resp)) {
         return $resp;
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:32,代码来源:Api.class.php


示例16: sendmessage

    public function sendmessage($content, $openid)
    {
        global $_W, $_GPC;
        $weid = $_W['weid'];
        $cfg = $this->module['config'];
        $appid = $cfg['appid'];
        $secret = $cfg['secret'];
        $img = $_W['attachurl'] . $cfg['kefuimg'];
        $id = $_W['openid'];
        //当前粉丝$openid为发送者
        $res = $this->getusers($weid, $id);
        load()->classs('weixin.account');
        $accObj = WeixinAccount::create($_W['account']['acid']);
        $access_token = $accObj->fetch_token();
        $token2 = $access_token;
        $title = $res['nickname'] . '给你发来新消息了!';
        $fans = pdo_fetch('SELECT salt,acid,openid FROM ' . tablename('mc_mapping_fans') . ' WHERE uniacid = :uniacid AND openid = :openid', array(':uniacid' => $weid, ':openid' => $openid));
        $pass['time'] = TIMESTAMP;
        $pass['acid'] = $fans['acid'];
        $pass['openid'] = $fans['openid'];
        $pass['hash'] = md5("{$fans['openid']}{$pass['time']}{$fans['salt']}{$_W['config']['setting']['authkey']}");
        $auth = base64_encode(json_encode($pass));
        $vars = array();
        $vars['__auth'] = $auth;
        $vars['forward'] = base64_encode($this->createMobileUrl('hitmail', array('toname' => $res['nickname'], 'toopenid' => $id)));
        $url2 = $_W['siteroot'] . 'app/' . murl('auth/forward', $vars);
        $data = '{
										"touser":"' . $openid . '",
										"msgtype":"news",
										"news":{
											"articles": [
											 {
												 "title":"' . $title . '",
												 "description":"' . $title . '",
												 "url":"' . $url2 . '",
												 "picurl":"' . $img . '",
											 }
											 ]
										}
									}';
        $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $token2;
        load()->func('communication');
        $it = ihttp_post($url, $data);
    }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:44,代码来源:site.php


示例17: sendMessage

 public function sendMessage($data, $notice = false)
 {
     global $_W;
     $reply = pdo_fetch('select * from ' . tablename('xwz_queue_reply') . ' where uniacid=:uniacid and rid=:rid limit 1', array(':uniacid' => $_W['uniacid'], ':rid' => $data['rid']));
     $type = pdo_fetch('select * from ' . tablename('xwz_queue_type') . ' where uniacid=:uniacid and  rid=:rid and id=:id limit 1', array(':uniacid' => $_W['uniacid'], ':rid' => $data['rid'], ':id' => $data['typeid']));
     $number = pdo_fetchcolumn('select count(*) from ' . tablename('xwz_queue_data') . ' where uniacid=:uniacid and  rid=:rid and typeid=:typeid and openid<>:openid  and status=0 and id<:id  ', array(':uniacid' => $_W['uniacid'], ':rid' => $reply['rid'], ':typeid' => $data['typeid'], ':openid' => $data['openid'], ':id' => $data['id']));
     //发送通知
     $sendtype = 0;
     // 0不发送 1 模板消息 2 客服消息
     //如果是认证服务号模板消息,如果认证号订阅号,客服消息
     load()->model('account');
     $account = account_fetch($_W['uniacid']);
     if ($account['level'] == 4) {
         //认证服务号
         $template_id = $reply['templateid'];
         if (!empty($template_id)) {
             $sendtype = 1;
         } else {
             $sendtype = 2;
         }
     } else {
         if ($account['level'] == 3) {
             //认证订阅号
             $sendtype = 2;
         }
     }
     $url = $_W['siteroot'] . 'app/index.php?i=' . $_W['uniacid'] . '&c=entry&m=xwz_queue&do=index&rid=' . $data['rid'];
     if ($sendtype == 1) {
         $data = json_encode(array('keyword1' => array('value' => $type['tag'] . $data['number']), 'keyword2' => array('value' => $type['title']), 'keyword3' => array('value' => $number . '位'), 'keyword4' => array('value' => $reply['heading']), 'keyword5' => array('value' => date('Y-m-d H:i', $data['createtime']))));
         load()->classs('weixin.account');
         $accObj = WeixinAccount::create($_W['uniacid']);
         $access_token = $accObj->fetch_token();
         if (!empty($access_token)) {
             load()->func('communication');
             $postarr = '{"touser":"' . $data['openid'] . '","template_id":"' . $template_id . '","url":"' . $url . '","data":' . $data . '}';
             $res = ihttp_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token, $postarr);
         }
     } else {
         if ($sendtype == 2) {
             $content = $notice ? "排号进度通知" : "取号成功通知\n\n";
             $content .= "号码:" . $type['tag'] . $data['number'] . "\n";
             $content .= "类型:" . $type['title'] . "\n";
             $content .= "前面还有:" . $number . "位\n";
             $content .= "商家:" . $reply['heading'] . "\n";
             $content .= "取号时间:" . date('Y-m-d H:i', $data['createtime']) . "\n\n";
             $content .= "<a href='{$url}'>点击查看详情</a>";
             $data = array("touser" => $data['openid'], "msgtype" => "text", "text" => array('content' => urlencode($content)));
             load()->classs('weixin.account');
             $accObj = WeixinAccount::create($_W['uniacid']);
             $access_token = $accObj->fetch_token();
             if (!empty($access_token)) {
                 $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={$access_token}";
                 load()->func('communication');
                 $res = ihttp_request($url, urldecode(json_encode($data)));
             }
         }
     }
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:58,代码来源:site.php


示例18: doWebUnauth_user

 public function doWebUnauth_user()
 {
     global $_W, $_GPC;
     $id = intval($_GPC['id']);
     $node = intval($_GPC['node']);
     $openid = $_GPC['openid'];
     $data = array('api_id' => $this->module['config']['authid'], 'api_key' => $this->module['config']['authkey'], 'node' => $node, 'openid' => $openid);
     load()->func('communication');
     $result = ihttp_post($this->unauth_user, json_encode($data));
     $result = json_encode($result['content'], true);
     //print_r($result);
     if ($result['status'] == 0) {
         pdo_update('wdl_wifi_authentication', array('result' => '0'), array('id' => $id));
         message('强制下线成功', referer(), 'success');
     } else {
         message('强制下线失败,错误详情为' . $result['err_msg']);
     }
 }
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:18,代码来源:site.php


示例19: pdo_fetch

global $_GPC, $_W;
WeSession::start($_W['uniacid'], $_W['fans']['from_user'], 60);
$mobile = $_GPC['mobile'];
if ($_GPC['type'] == 'verify') {
    $member = pdo_fetch("select * from" . tablename("xcommunity_member") . "where weid='{$_W['uniacid']}' and mobile=:mobile", array(':mobile' => $mobile));
} else {
    $member = pdo_fetch("select * from" . tablename("xcommunity_business") . "where weid='{$_W['uniacid']}' and mobile=:mobile", array(':mobile' => $mobile));
}
if (!empty($member)) {
    message('该号码已经注册,请更换号码,重新注册', referer(), 'success');
    exit;
}
if ($mobile == $_SESSION['mobile']) {
    $code = $_SESSION['code'];
} else {
    $code = random(6, 1);
    $_SESSION['mobile'] = $mobile;
    $_SESSION['code'] = $code;
}
//验证是否开启
if ($this->module['config']['verifycode'] || $this->module['config']['businesscode']) {
    $mobile = $_SESSION['mobile'];
    $tpl_id = $this->module['config']['resgisterid'];
    $tpl_value = urlencode("#code#={$code}");
    $appkey = $this->module['config']['sms_account'];
    $params = "mobile=" . $mobile . "&tpl_id=" . $tpl_id . "&tpl_value=" . $tpl_value . "&key=" . $appkey;
    $url = 'http://v.juhe.cn/sms/send';
    load()->func('communication');
    $content = ihttp_post($url, $params);
    return $content;
}
开发者ID:guohuadeng,项目名称:wuyeWq,代码行数:31,代码来源:verifycode.inc.php


示例20: sms_send

function sms_send($mobile = '', $content = '', $signature = '', $check = true)
{
    global $_W;
    $setting = setting_load('sms');
    load()->func('communication');
    if (empty($setting['sms'])) {
        return error(1, "未设置短信接口,无法发送短信!");
    }
    if (!empty($setting['sms']) && $setting['sms']['type'] == 'yimei') {
        if (empty($setting['sms']['url']) || empty($setting['sms']['password']) || empty($setting['sms']['serialNumber']) || empty($setting['sms']['sessionKey'])) {
            return error(1, "亿美短信接口配置不完整,无法发送短信!");
        }
    }
    if (!empty($setting['sms']) && $setting['sms']['type'] == 'dxton') {
        if (empty($setting['sms']['dxton_username']) || empty($setting['sms']['dxton_pwd'])) {
            return error(1, "短信通接口配置不完整,无法发送短信!");
        }
    }
    if (!empty($setting['sms']) && $setting['sms']['type'] == 'smscn') {
        if (empty($setting['sms']['smscn_uid']) || empty($setting['sms']['smscn_pwd'])) {
            return error(1, "云信接口配置不完整,无法发送短信!");
        }
    }
    $config = $setting['sms'];
    $smsconfig = array("balance" => 0, "signature" => $_W['setting']['sitename']);
    $row = pdo_fetch("SELECT `notify` FROM " . tablename('uni_settings') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid']));
    $row['notify'] = @iunserializer($row['notify']);
    if (!empty($row['notify']) && !empty($row['notify']['sms'])) {
        $smsconfig = $row['notify']['sms'];
    }
    if ($check) {
        if (intval($smsconfig['balance']) <= 0) {
            return error(1, "短信条数不足,请联系客服人员");
        }
    }
    if (empty($signature)) {
        $signature = "";
    }
    if ($config['type'] == 'yimei') {
        $content = "【" . $signature . "】" . $content;
        $sms = new SMSUtil($config['url'], $config['serialNumber'], $config['password'], $config['sessionKey'], array("proxyhost" => $config['proxyhost'], "proxyport" => $config['proxyport'], "proxyusername" => $config['proxyusername'], "proxypassword" => $config['proxypassword']), $config['timeout'], $config['response_timeout']);
        $err = $sms->send($mobile, $content);
        if (empty($err)) {
            $row['notify']['sms']['balance'] = intval($row['notify']['sms']['balance']) - 1;
            pdo_update('uni_settings', array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid']));
            return true;
        }
        return error(1, $err);
    } else {
        if ($config['type'] == 'dxton') {
            $username = $config['dxton_username'];
            $pwd = $config['dxton_pwd'];
            $target = "http://www.dxton.com/webservice/sms.asmx/Submit";
            $post_data = "account=" . $username . "&password=" . $pwd . "&mobile=" . $mobile . "&content=" . rawurlencode($content);
            $result = ihttp_request($target, $post_data);
            $xml = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA);
            $result = (string) $xml->result;
            $message = (string) $xml->message;
            if ($result == '100') {
                $row['notify']['sms']['balance'] = intval($row['notify']['sms']['balance']) - 1;
                pdo_update('uni_settings', array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid']));
                return true;
            }
            return error(1, $message);
        } else {
            if ($config['type'] == 'smscn') {
                $uid = $config['smscn_uid'];
                $pwd = md5($config['smscn_pwd'] . $uid);
                $target = 'http://api.sms.cn/mtutf8/';
                $content = "【" . $signature . "】" . $content;
                $post_data = "uid=" . $uid . "&pwd=" . $pwd . "&mobile=" . $mobile . "&content=" . urlencode($content);
                $result = ihttp_post($target, $post_data);
                if (is_array($result)) {
                    $contents = explode("&", $result['content']);
                    $codes = isset($contents[1]) ? explode("=", $contents[1]) : '';
                    $messsages = isset($contents[2]) ? explode("=", $contents[2]) : '';
                    if (is_array($codes)) {
                        $code = $codes[1];
                        $message = $messsages[1];
                        if ($code == '100') {
                            $row['notify']['sms']['balance'] = intval($row['notify']['sms']['balance']) - 1;
                            pdo_update('uni_settings', array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid']));
                            return true;
                        }
                        return error(1, $message);
                    }
                }
                return error(1, "发送短信失败!");
            }
        }
    }
}
开发者ID:eduNeusoft,项目名称:weixin,代码行数:92,代码来源:sms.func.php



注:本文中的ihttp_post函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ihttp_request函数代码示例发布时间:2022-05-15
下一篇:
PHP ihttp_get函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap