public function get_remote_image() { $content = $_POST['content']; if (empty($content)) { $this->msg('没有获取到内容!', 0); } //文件路径 $file_path = __ROOTDIR__ . '/upload/' . date('Y-m') . '/' . date('d') . '/'; //文件URL路径 $file_url = __ROOTURL__ . '/upload/' . date('Y-m') . '/' . date('d') . '/'; $body = html_out($content); $img_array = array(); preg_match_all("/(src|SRC)=[\"|'| ]{0,}(http:\\/\\/(.*)\\.(gif|jpg|jpeg|bmp|png))/isU", $body, $img_array); $img_array = array_unique($img_array[2]); set_time_limit(0); $milliSecond = date("dHis") . '_'; if (!is_dir($file_path)) { @mkdir($file_path, 0777, true); } foreach ($img_array as $key => $value) { $value = trim($value); $ext = explode('.', $value); $ext = end($ext); $get_file = @Http::doGet($value, 5); $rndFileName = $file_path . $milliSecond . $key . '.' . $ext; $fileurl = $file_url . $milliSecond . $key . '.' . $ext; if ($get_file) { $status = @file_put_contents($rndFileName, $get_file); if ($status) { $body = str_replace($value, $fileurl, $body); } } } $this->msg($body, 1); }
public function get_keyword($title, $content) { $data = Http::doGet('http://keyword.discuz.com/related_kw.html?ics=utf-8&ocs=utf-8&title=' . urlencode($title) . '&content=' . urlencode($content), 10); if (empty($data)) { return; } preg_match_all("/<kw>(.*)A\\[(.*)\\]\\](.*)><\\/kw>/", $data, $list, PREG_SET_ORDER); if (empty($list)) { return; } $keywords = ''; foreach ($list as $value) { $keywords .= $value[2] . ','; } return substr($keywords, 0, -1); }
/** * 订单跟踪 */ public function order_tracking() { $order_id = I('get.order_id', 0); $ajax = I('get.ajax', 0); $where['user_id'] = $this->user_id; $where['order_id'] = $order_id; $orders = $this->model->table('order_info')->field('order_id, order_sn, invoice_no, shipping_name, shipping_id')->where($where)->find(); // 生成快递100查询接口链接 $shipping = get_shipping_object($orders['shipping_id']); $query_link = $shipping->kuaidi100($orders['invoice_no']); $get_content = Http::doGet($query_link); $this->assign('title', L('order_tracking')); $this->assign('trackinfo', $get_content); $this->display('user_order_tracking.dwt'); }
/** * 微信提醒 * * @param $type 提醒类型 * @param $title 提醒标题 * @param $msg 提醒内容 * @param $url 页面链接 base64_decode(urldecode($url)); * @param $order_id 订单id * */ function send_wechat_message($type = '', $title = '', $msg = '', $url = '', $order_id = '') { /* 如果需要,微信通知 wanglu */ if (!empty($type)) { $remind = M()->table('wechat_extend')->field('name, config')->where('enable = 1 and command = "' . $type . '"')->find(); $config = unserialize($remind['config']); $title = $remind['name'] ? $remind['name'] : $title; $msg = $config['template'] ? str_replace('[$order_id]', $order_id, $config['template']) : $msg; $openid = M()->table('wechat_user')->field('openid')->where('ect_uid = ' . $_SESSION['user_id'])->getOne(); if (!empty($title) && !empty($openid)) { $dourl = __HOST__ . url('api/index', array('openid' => $openid, 'title' => $title, 'msg' => $msg, 'url' => $url)); Http::doGet($dourl); } } }
//强制转换为数组 $postData = (array) simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); /* 支付方式代码 */ $pay_code = 'wxpay'; /* 支付信息 */ // $payment = get_payment($pay_code); $payment = model('Payment')->get_payment($pay_code); //确定为新增还是确认 if (isset($postData['TransId']) && !empty($postData['TransId'])) { $data = $postData; } else { $data = $postData; } //标记客户的投诉处理状态api //获取access_token $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $payment['wxpay_appid'] . '&secret=' . $payment['wxpay_appsecret']; $data = Http::doGet($url); $token = json_decode($data); //标记客户的投诉处理状态 $url1 = 'https://api.weixin.qq.com/payfeedback/update?access_token=' . $token->access_token . '&openid=' . $data['OpenId'] . '&feedbackid=' . $data['FeedBackId']; $rs = Http::doGet($url1); $rs_back = json_decode($rs); if ($rs_back->errcode == 0) { echo $rs_back->errmsg; //OK //logResult($rs_back->errmsg); } else { echo $rs_back->errcode . ':' . $rs_back->errmsg; //logResult($rs_back->errcode . ':' . $rs_back->errmsg); } }
public function authorize() { $url = 'http://service.duxcms.com/authorize/search?keyword=' . urlencode($_SERVER['SERVER_NAME']) . '&ajax=1'; $content = @Http::doGet($url, 10); if (empty($content)) { $this->msg('暂时无法获取到您站点的授权信息,请稍后再试!'); } else { $this->msg($content); } }
$data['sign_method'] = "sha1"; //获取access_token $url_token = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $payment['wxpay_appid'] . '&secret=' . $payment['wxpay_appsecret']; $data_token = Http::doGet($url_token); $token = json_decode($data_token); //发货通知微信 $url1 = 'https://api.weixin.qq.com/pay/delivernotify?access_token=' . $token->access_token; $data1 = Http::doPost($url1, $data, 5, '', 'json'); $rs1 = json_decode($data1); //成功通知微信 if ($rs1->errcode == 0) { //echo 'success'; } else { //获取access_token $url_token1 = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $payment['wxpay_appid'] . '&secret=' . $payment['wxpay_appsecret']; $data_token1 = Http::doGet($url_token1); $token1 = json_decode($data_token1); //第一次失败再次发送发货通知微信 $url2 = 'https://api.weixin.qq.com/pay/delivernotify?access_token=' . $token1->access_token; $data2 = Http::doPost($url2, $data, 5, '', 'json'); $rs2 = json_decode($data2); if ($rs2->errcode == 0) { //echo 'success'; } else { exit($rs2->errcode . ':' . $rs2->errmsg); } } } //打印日志 function logResult($word = '') {
/** * 获取补丁列表 */ private function pathlist() { $pathlist_str = Http::doGet($this->upgrade_path_base); $pathlist = $allpathlist = array(); $key = -1; // 获取压缩包列表 preg_match_all("/\"(patch_R[\\w_]+\\.zip)\"/", $pathlist_str, $allpathlist); $allpathlist = $allpathlist[1]; // 获取可供当前版本升级的压缩包 foreach ($allpathlist as $k => $v) { if (strstr($v, 'patch_R' . RELEASE)) { $key = $k; break; } } $key = $key < 0 ? 9999 : $key; foreach ($allpathlist as $k => $v) { if ($k > $key) { $pathlist[$k] = $v; } } return $pathlist; }