本文整理汇总了PHP中ihttp_post函数的典型用法代码示例。如果您正苦于以下问题:PHP ihttp_post函数的具体用法?PHP ihttp_post怎么用?PHP ihttp_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ihttp_post函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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');
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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');
示例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;
}
示例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);
}
示例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;