本文整理汇总了PHP中ihttp_request函数的典型用法代码示例。如果您正苦于以下问题:PHP ihttp_request函数的具体用法?PHP ihttp_request怎么用?PHP ihttp_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ihttp_request函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cron_run
function cron_run($id)
{
global $_W;
$cron = pdo_get('core_cron', array('uniacid' => $_W['uniacid'], 'id' => $id));
if (empty($cron)) {
return false;
}
$extra = array();
$extra['Host'] = $_SERVER['HTTP_HOST'];
load()->func('communication');
$urlset = parse_url($_W['siteurl']);
$urlset = pathinfo($urlset['path']);
$response = ihttp_request('http://127.0.0.1/' . $urlset['dirname'] . '/' . url('cron/entry', array('id' => $cron['cloudid'])), array(), $extra);
$response = json_decode($response['content'], true);
if (is_error($response['message'])) {
return $response['message'];
} else {
cron_setnexttime($cron);
$cron_new = pdo_get('core_cron', array('uniacid' => $_W['uniacid'], 'id' => $id));
if (empty($cron_new)) {
return true;
}
if ($cron_new['status'] != $cron['status'] || $cron_new['lastruntime'] != $cron['lastruntime'] || $cron_new['nextruntime'] != $cron['nextruntime']) {
load()->model('cloud');
$cron_new['id'] = $cron_new['cloudid'];
$status = cloud_cron_update($cron_new);
if (is_error($status)) {
return $status;
}
}
}
return true;
}
示例2: responseText
private function responseText($obj)
{
global $_W;
$timeout = 4;
load()->func('communication');
ihttp_request($_W['siteroot'] . 'app/index.php?i=' . $_W['uniacid'] . '&c=entry&m=ewei_shop&do=plugin&p=poster&method=build', array("openid" => $obj->message['from'], "content" => urlencode($obj->message['content'])), null, $timeout);
return $this->responseEmpty();
}
示例3: getSimsimiReply
private function getSimsimiReply($sendtext='') {
$url = 'http://api.we7.cc/v1/simsimi.php?msg='.urlencode($sendtext);
$response = ihttp_request($url);
if (!empty($response['content'])) {
return json_decode($response['content'], true);
} else {
return array();
}
}
示例4: post
private function post()
{
global $_W, $engine;
if (!in_array($this->message['msgtype'], array('text', 'image'))) {
return false;
}
$member = $this->getMember();
$wall = pdo_fetch("SELECT * FROM " . tablename('wxwall_reply') . " WHERE rid = :rid LIMIT 1", array(':rid' => $member['rid']));
if (!empty($wall['timeout']) && $wall['timeout'] > 0 && TIMESTAMP - $member['lastupdate'] >= $wall['timeout']) {
$this->endContext();
return $this->respText('由于您长时间未操作,请重新进入微信墙!');
}
$this->refreshContext();
if (empty($wall['quit_command']) && $this->message['content'] == '退出' || !empty($wall['quit_command']) && $this->message['content'] == $wall['quit_command']) {
$this->endContext();
return $this->respText($wall['quit_tips']);
}
if (empty($member['nickname']) || empty($member['avatar'])) {
return $this->respText('发表话题前请完善您的基本信息,<a target="_blank" href="' . $this->createMobileUrl('register') . '">点击完善</a>。');
}
$data = array('rid' => $member['rid'], 'from_user' => $_W['member']['uid'], 'type' => $this->message['type'], 'createtime' => TIMESTAMP);
if (empty($wall['isshow']) && empty($member['isblacklist'])) {
$data['isshow'] = 1;
} else {
$data['isshow'] = 0;
}
if ($this->message['type'] == 'text') {
$data['content'] = $this->message['content'];
}
if ($this->message['type'] == 'image') {
load()->func('communication');
$image = ihttp_request($this->message['picurl']);
$partPath = IA_ROOT . '/' . $_W['config']['upload']['attachdir'] . '/';
do {
$filename = "images/{$_W['uniacid']}/" . date('Y/m/') . random(30) . '.jpg';
} while (file_exists($partPath . $filename));
file_write($filename, $image['content']);
$data['content'] = $filename;
}
if ($this->message['type'] == 'link') {
$data['content'] = iserializer(array('title' => $this->message['title'], 'description' => $this->message['description'], 'link' => $this->message['link']));
}
pdo_insert('wxwall_message', $data);
if (!empty($member['isblacklist'])) {
$content .= '你已被列入黑名单,发送的消息需要管理员审核!';
} elseif (!empty($wall['isshow'])) {
$content = '发送消息成功,请等待管理员审核';
} elseif (!empty($wall['send_tips'])) {
$content = $wall['send_tips'];
} else {
$content = '发送消息成功。';
}
return $this->respText($content);
}
示例5: get_access_token
public function get_access_token()
{
load()->func('communication');
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $this->appid . "&secret=" . $this->appsn;
$content2 = ihttp_request($url);
//$result =$this->get_curl($url);
//print_r($url);
$info = json_decode($content2['content'], true);
$access_token = $info['access_token'];
return $access_token;
}
示例6: xiaojo
function xiaojo($msg, $openid)
{
$yourdb = 'ourstudio';
//小九帐号
$yourpw = 'ourstudio514';
//小九密码
$msg = urlencode($msg);
$openid = urlencode($openid);
$yourdb = urlencode($yourdb);
$url = 'http://www.xiaojo.com/api5.php?chat=' . $msg . '&db=' . $yourdb . '&pw=' . $yourpw . '&from=' . $openid;
$response = ihttp_request($url);
$reply = urldecode($response['content']);
return $reply;
}
示例7: getList
function getList($express, $expresssn)
{
$url = "http://wap.kuaidi100.com/wap_result.jsp?rand=" . time() . "&id={$express}&fromWeb=null&postid={$expresssn}";
load()->func('communication');
$resp = ihttp_request($url);
$content = $resp['content'];
if (empty($content)) {
return array();
}
preg_match_all('/\\<p\\>·(.*)\\<\\/p\\>/U', $content, $arr);
if (!isset($arr[1])) {
return false;
}
return $arr[1];
}
示例8: post
private function post()
{
global $_W;
if (!in_array($this->message['msgtype'], array('text', 'image'))) {
return '微信墙只能发表文字和图片';
}
$member = $this->getMember();
$sql = 'SELECT * FROM ' . tablename('wxwall_reply') . ' WHERE `rid` = :rid';
$wall = pdo_fetch($sql, array(':rid' => $this->rule));
if (intval($wall['timeout']) > 0 && $wall['timeout'] + $member['lastupdate'] < TIMESTAMP) {
$this->endContext();
return '由于您长时间未操作,请重新进入微信墙!';
}
$this->refreshContext();
if (empty($wall['quit_command']) && $this->message['content'] == '退出' || !empty($wall['quit_command']) && $this->message['content'] == $wall['quit_command']) {
$this->endContext();
return empty($wall['quit_tips']) ? '您已成功退出微信墙' : $wall['quit_tips'];
}
$data = array('rid' => $this->rule, 'from_user' => $_W['openid'], 'type' => $this->message['type'], 'createtime' => TIMESTAMP);
if (empty($wall['isshow']) && empty($member['isblacklist'])) {
$data['isshow'] = 1;
}
// 文字类型信息
if ($this->message['type'] == 'text') {
$data['content'] = $this->message['content'];
}
// 图片类型信息
if ($this->message['type'] == 'image') {
load()->func('file');
load()->func('communication');
$image = ihttp_request($this->message['picurl']);
$filename = 'images/' . $_W['uniacid'] . '/' . date('Y/m/') . md5(TIMESTAMP + CLIENT_IP + random(12)) . '.jpg';
file_write($filename, $image['content']);
$data['content'] = $filename;
}
pdo_insert('wxwall_message', $data);
if (!empty($member['isblacklist'])) {
$content = '你已被列入黑名单,发送的消息需要管理员审核!';
} elseif (!empty($wall['isshow'])) {
$content = '发送消息成功,请等待管理员审核';
} elseif (!empty($wall['send_tips'])) {
$content = $wall['send_tips'];
} else {
$content = '发送消息成功。';
}
return $content;
}
示例9: autoFinishOrders
private function autoFinishOrders()
{
global $_W;
$file = IA_ROOT . "/addons/ewei_shop/data/receive";
$lasttime = strtotime(@file_get_contents($file));
$interval = intval(@file_get_contents(IA_ROOT . "/addons/ewei_shop/data/receive_time"));
if (empty($interval)) {
$interval = 60;
}
$interval *= 60;
$current = time();
if ($lasttime + $interval <= $current) {
file_put_contents($file, date('Y-m-d H:i:s', $current));
load()->func('communication');
ihttp_request($_W['siteroot'] . "addons/ewei_shop/core/mobile/order/receive.php", null, null, 1);
}
}
示例10: post
private function post()
{
global $_W, $engine;
if (!in_array($this->message['msgtype'], array('text', 'image'))) {
return false;
}
$member = $this->getMember();
$wall = pdo_fetch("SELECT * FROM " . tablename('wxwall_reply') . " WHERE rid = '{$member['rid']}' LIMIT 1");
if (!empty($wall['timeout']) && $wall['timeout'] > 0 && TIMESTAMP - $member['lastupdate'] >= $wall['timeout']) {
$this->endContext();
return $this->respText('由于您长时间未操作,请重新进入微信墙!');
}
$this->refreshContext();
if (empty($wall['quit_command']) && $this->message['content'] == '退出' || !empty($wall['quit_command']) && $this->message['content'] == $wall['quit_command']) {
$this->endContext();
return $this->respText($wall['quit_tips']);
}
if (empty($member['nickname'])) {
return $this->respText('发表话题前请<a target="_blank" href="' . $this->createMobileUrl('register') . '">登记</a>您的信息。');
}
$data = array('rid' => $member['rid'], 'from_user' => $this->message['from'], 'type' => $this->message['type'], 'createtime' => TIMESTAMP);
if (empty($wall['isshow']) && empty($member['isblacklist'])) {
$data['isshow'] = 1;
} else {
$data['isshow'] = 0;
}
if ($this->message['type'] == 'text') {
$data['content'] = $this->message['content'];
}
if ($this->message['type'] == 'image') {
$image = ihttp_request($this->message['picurl']);
$filename = 'wxwall/' . $member['rid'] . '/' . random(30) . '.jpg';
file_write($filename, $image['content']);
$data['content'] = $filename;
}
if ($this->message['type'] == 'link') {
$data['content'] = iserializer(array('title' => $this->message['title'], 'description' => $this->message['description'], 'link' => $this->message['link']));
}
pdo_insert('wxwall_message', $data);
pdo_update('wxwall_members', array('lastupdate' => TIMESTAMP), array('from_user' => $this->message['from']));
$content = $wall['send_tips'];
if (!empty($member['isblacklist'])) {
$content .= '你已被列入黑名单,发送的消息需要管理员审核!';
}
return $this->respText($content);
}
示例11: getJsApiTicket
private function getJsApiTicket()
{
$ticket = cache_read("js_api_ticket");
if (empty($ticket) || $ticket["time"] <= time()) {
$token = $this->getWxAccessToken();
if (!empty($token)) {
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={$token}&type=jsapi";
$js_token = ihttp_request($url);
if (!empty($js_token)) {
$content = @json_decode($js_token['content'], true);
$ticket = array("ticket" => $content["ticket"], "time" => TIMESTAMP + $content["expires_in"]);
cache_write("js_api_ticket", $ticket);
}
}
}
return $ticket["ticket"];
}
示例12: respond
public function respond()
{
$content = $this->message['content'];
global $_W;
if (!strcmp($this->message['type'], 'image')) {
$count = pdo_fetchcolumn("select count(*) from " . tablename("ice_picWallMain") . " where openid = :openid and uniacid = :uniacid", array(":openid" => $_W['openid'], ":uniacid" => $_W['uniacid']));
if ($count > 0) {
$url = $this->buildSiteUrl($this->createMobileUrl('Index', array()));
$url2 = $this->buildSiteUrl($this->createMobileUrl('getInfo', array()));
$message = sprintf("您已经上传过照片到照片墙,无需重复上传。<a href='%s'>查看照片墙</a>。", $url, $url2);
return $this->respText($message);
}
$message = $this->message;
$showID = $this->getShowID();
load()->func('communication');
$image = ihttp_request($this->message['picurl']);
$partPath = IA_ROOT . '/' . $_W['config']['upload']['attachdir'] . '/';
do {
$filename = "images/{$_W['uniacid']}/" . date('Y/m/') . random(30) . '.jpg';
} while (file_exists($partPath . $filename));
file_write($filename, $image['content']);
$data['content'] = $filename;
$data = array('uniacid' => $_W['uniacid'], 'openid' => $_W['openid'], 'tousername' => $message['to'], 'showID' => $showID, 'imgurl' => $filename, 'time' => $message['time']);
$data['tousername'] = $message['to'];
$url = $this->buildSiteUrl($this->createMobileUrl('Index', array()));
$url2 = $this->buildSiteUrl($this->createMobileUrl('getInfo', array()));
$ds = pdo_insert('ice_picWallMain', $data);
$message = sprintf("照片上传成功,请点击<a href='%s'>照片墙</a>,并留下<a href='%s'>您的信息</a>,方便与您取得联系。", $url, $url2);
if ($ds) {
return $this->respText($message);
} else {
return $this->respText('照片上传失败');
}
} elseif (!strcmp($this->message['type'], 'text')) {
return $this->respText('照片墙更多活动请了解');
} else {
return $this->respText('照片上传失败');
}
}
示例13: doWebIncomingTxWall
/**
* 异步处理腾讯墙信息
*/
public function doWebIncomingTxWall()
{
global $_W, $_GPC;
$id = intval($_GPC['id']);
$result = array('status' => 0);
$lastmsgtime = intval($_GPC['lastmsgtime']);
$lastuser = '';
$wall = pdo_fetchcolumn("SELECT syncwall FROM " . tablename('wxwall_reply') . " WHERE rid = :rid LIMIT 1", array(':rid' => $id));
if (empty($wall)) {
message($result, '', 'ajax');
}
$wall = iunserializer($wall);
if (empty($wall['tx']['status'])) {
message($result, '', 'ajax');
}
load()->func('communication');
$response = ihttp_request('http://wall.v.t.qq.com/index.php?c=wall&a=topic&ak=801424380&t=' . $wall['tx']['subject'] . '&fk=&fn=&rnd=' . TIMESTAMP);
if (empty($response['content'])) {
$result['status'] = -1;
message($result, '', 'ajax');
}
$last = pdo_fetch("SELECT createtime, from_user FROM " . tablename('wxwall_message') . " WHERE createtime >= :createtime AND type = 'txwall' AND rid = :rid ORDER BY createtime DESC LIMIT 1", array(':createtime' => $lastmsgtime, ':rid' => $id));
if (!empty($last)) {
$lastmsgtime = $last['createtime'];
$lastuser = $last['from_user'];
}
$list = json_decode($response['content'], true);
if (!empty($list['data']['info'])) {
$insert = array();
foreach ($list['data']['info'] as $row) {
if ($row['timestamp'] < $lastmsgtime || $lastmsgtime == $row['timestamp'] && !empty($lastuser) && $lastuser == $row['name']) {
break;
}
$content = array('nickname' => $row['nick'], 'avatar' => !empty($row['head']) ? $row['head'] . '/120' : '', 'content' => $row['text']);
$insert[] = array('rid' => $id, 'content' => iserializer($content), 'from_user' => $row['name'], 'type' => 'txwall', 'isshow' => 1, 'createtime' => $row['timestamp']);
}
unset($row);
if (!empty($insert)) {
$insert = array_reverse($insert);
foreach ($insert as $row) {
pdo_insert('wxwall_message', $row);
}
}
$lastmsgtime = $row['timestamp'];
$result = array('status' => 1, 'lastmsgtime' => $lastmsgtime);
message($result, '', 'ajax');
} else {
message($result, '', 'ajax');
}
}
示例14: message
if ($do == 'promotion') {
if (empty($_W['setting']['site']['key']) || empty($_W['setting']['site']['token'])) {
message("你的程序需要在微动力云服务平台注册你的站点资料, 来接入云平台服务后才能使用推广功能.", url('cloud/profile'), 'error');
}
$auth['forward'] = 'promotion';
$iframe = __to($auth);
$title = '我要推广';
}
if ($do == 'buyversion') {
load()->func('communication');
$auth['forward'] = 'buyversion';
$auth['name'] = $_GPC['m'];
$auth['is_upgrade'] = 1;
$auth['version'] = $_GPC['version'];
$url = __to($auth);
$response = ihttp_request($url);
if (is_error($response)) {
message($response['message'], '', 'error');
}
$response = json_decode($response['content'], true);
switch ($response['message']['errno']) {
case '-1':
case '-2':
message('模块不存在或是未有更新的版本。', url('extension/module'), 'error');
break;
case '-3':
message('您的交易币不足以支付此次升级费用。', url('extension/module'), 'error');
break;
case '2':
message('您已经购买过此升级版本,系统将直接跳转至升级界面。', url('cloud/process', array('m' => $auth['name'], 'is_upgrade' => 1, 'is_buy' => 1)), 'success');
break;
示例15: changeWechatSend
private function changeWechatSend($id, $status, $msg = '')
{
global $_W;
$paylog = pdo_fetch("SELECT plid, openid, tag FROM " . tablename('paylog') . " WHERE tid = '{$id}' AND status = 1 AND type = 'wechat'");
if (!empty($paylog['openid'])) {
$paylog['tag'] = iunserializer($paylog['tag']);
$send = array('appid' => $_W['account']['payment']['wechat']['appid'], 'openid' => $paylog['openid'], 'transid' => $paylog['tag']['transaction_id'], 'out_trade_no' => $paylog['plid'], 'deliver_timestamp' => TIMESTAMP, 'deliver_status' => $status, 'deliver_msg' => $msg);
$sign = $send;
$sign['appkey'] = $_W['account']['payment']['wechat']['signkey'];
ksort($sign);
foreach ($sign as $key => $v) {
$key = strtolower($key);
$string .= "{$key}={$v}&";
}
$send['app_signature'] = sha1(rtrim($string, '&'));
$send['sign_method'] = 'sha1';
$token = account_weixin_token($_W['account']);
$sendapi = 'https://api.weixin.qq.com/pay/delivernotify?access_token=' . $token;
$response = ihttp_request($sendapi, json_encode($send));
$response = json_decode($response['content'], true);
if (empty($response)) {
message('发货失败,请检查您的公众号权限或是公众号AppId和公众号AppSecret!');
}
if (!empty($response['errcode'])) {
message($response['errmsg']);
}
}
}