首页
友人帐
留言板
关于
Search
1
IDE Eval Resetter:JetBrains 全家桶无限试用插件
382 阅读
2
影视资源采集站收录大全
309 阅读
3
linux安装或升级protoc
226 阅读
4
VFM 3.7.5 源码 - 一个极简的 PHP 私人云盘!
161 阅读
5
批量采集美女写真等图片做图片站
150 阅读
谈天说地
程序源码
技术教程
成品源码
登录
Search
标签搜索
PHP
linux
源码
go
windows
centos
原创
mysql
微信
激活
采集
宝塔
绿色版
API
解析
SDK
图片
破解
域名
html
云青
累计撰写
150
篇文章
累计收到
81
条评论
首页
栏目
谈天说地
程序源码
技术教程
成品源码
页面
友人帐
留言板
关于
搜索到
92
篇与
的结果
2019-11-02
[更新]php微信支付类(含h5支付、APP二次签名、jsapi支付)
博主之封装过一个微信支付类 很长时间没有更新了 现在分享一下自用的微信支付类该类含有微信app支付 h5支付 公众号支付(jsapi) 订单查询native扫码支付后面会添加异步主要商户订单号查询 并确定金额是否与数据库中一致以及判断该商户订单号是否处理过(谨记)个人觉得验签并不重要 有订单查询以及数据库订单验证就行了过多的就不介绍了 源码有注释<?php /** * @author anderyly * @email anderyly@sina.com * @link https://blog.aaayun.cc/ * @copyright Copyright (c) 2018 */ class WxPay { // 微信分配的公众账号ID public $appId; // 微信支付分配的商户号 public $mch_id; // 微信支付分配的商户密钥 public $key; // 回调地址 public $notify_url; // 随机字符串 public $nonce_str; // 站点名称 public $webName; // 站点url地址 public $webUrl; // h5支付成功后跳转的地址 public $redirect_url; /** * [__construct 初始化配置] */ public function __construct($data) { $this->appId = $data['appId']; $this->mch_id = $data['mch_id']; $this->key = $data['key']; $this->notify_url = $data['notify_url']; if (isset($data['webName'])) $this->webName = $data['webName']; if (isset($data['webUrl'])) $this->webUrl = $data['webUrl']; if (isset($data['redirect_url'])) $this->redirect_url = $data['redirect_url']; $this->nonce_str = $this->rand_code(); } /** * [h5 html5支付] * @param out_trade_no [订单号] * @param $body [商品描述] * @param $ip [ip地址] * @param $total_fee [订单总金额] * @return array|bool */ public function h5($out_trade_no, $body, $ip, $total_fee) { $url = 'https://api.mch.weixin.qq.com/pay/unifiedorder'; $data = [ 'appid' => $this->appId, 'mch_id' => $this->mch_id, 'body' => $body, 'spbill_create_ip' => $ip, 'total_fee' => $total_fee * 100, 'out_trade_no' => $out_trade_no, 'nonce_str' => $this->nonce_str, 'notify_url' => $this->notify_url, 'trade_type' => 'MWEB', 'scene_info' => "{'h5_info':{'type': 'WAP','wap_url': $this->webUrl,'wap_name': $this->webName}}" ]; $data['sign'] = $this->sign($data); //获取签名 $data = $this->curlWx($url, $this->ToXml($data)); if ($data) { $res = $this->FromXml($data); if (isset($res['return_code']) and $res['return_code'] != 'SUCCESS' and isset($res['return_msg']) and $res['return_msg'] == 'OK' and isset($res['result_code']) and $res['result_code'] == 'SUCCESS') { exit("签名失败!"); } else { $url = $res['mweb_url'] . '&redirect_url=' . urlencode($this->redirect_url); exit('<script src="https://open.mobile.qq.com/sdk/qqapi.js?_bid=152"></script><script type="text/javascript">mqq.ui.openUrl({ target: 2,url: "' . $url . '"});</script>'); } } } /** * [app 移动端二次签名] * @param out_trade_no [订单号] * @param $body [商品描述] * @param $ip [ip地址] * @param $total_fee [订单总金额] * @return array|bool */ public function app($out_trade_no, $body, $ip, $total_fee) { $url = 'https://api.mch.weixin.qq.com/pay/unifiedorder'; $data = [ 'appid' => $this->appId, 'mch_id' => $this->mch_id, 'body' => $body, 'spbill_create_ip' => $ip, 'total_fee' => $total_fee * 100, 'out_trade_no' => $out_trade_no, 'nonce_str' => $this->nonce_str, 'notify_url' => $this->notify_url, 'trade_type' => 'APP', ]; $data['sign'] = $this->Sign($data); $data = $this->curlWx($url, $this->ToXml($data)); if ($data) { $res = $this->FromXml($data); if ($res['return_code'] != 'SUCCESS') { return false; } else { $arr = [ 'prepayid' => $res['prepay_id'], 'appid' => $this->appId, 'partnerid' => $this->mch_id, 'package' => 'Sign=WXPay', 'noncestr' => $this->nonce_str, 'timestamp' => time(), ]; $sign = $this->sign($arr, 1); $arr['out_trade_no'] = $out_trade_no; $arr['return_code'] = $res['return_code']; $arr['sign'] = $sign; return $arr; } } else { return false; } } /** * [h5 html5支付] * @param $out_trade_no [订单号] * @param $body [商品描述] * @param $ip [ip地址] * @param $total_fee [订单总金额] * @param $openid [授权用户的openid] * @return array|bool */ public function jsapi($out_trade_no, $body, $ip, $total_fee, $openid) { $url = 'https://api2.mch.weixin.qq.com/pay/unifiedorder'; $data = [ 'appid' => $this->appId, 'mch_id' => $this->mch_id, 'body' => $body, 'spbill_create_ip' => $ip, 'total_fee' => $total_fee * 100, 'out_trade_no' => $out_trade_no, 'nonce_str' => $this->nonce_str, 'notify_url' => $this->notify_url, 'trade_type' => 'JSAPI', 'openid' => $openid ]; $data['sign'] = $this->Sign($data, 1); $data = $this->curlWx($url, $this->ToXml($data)); if ($data) { $res = $this->FromXml($data); if ($res['return_code'] != 'SUCCESS') { return false; } else { $arr = [ 'appId' => $res['appid'], 'package' => 'prepay_id=' . $res['prepay_id'], 'nonceStr' => $this->nonce_str, 'timeStamp' => time(), 'signType' => 'MD5' ]; $sign = $this->sign($arr); $as['nonceStr'] = $arr['nonceStr']; $as['package'] = $arr['package']; $as['sign'] = $sign; $as['timestamp'] = $arr['timeStamp']; $as['appid'] = $arr['appId']; return $as; } } else { return false; } } /** * [curlWx 发送curl请求] * @param $url [url地址] * @param $xml [xml] * @return mixed */ protected function curlWx($url, $xml) { //header("Content-type:text/xml"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); if (stripos($url, "https://") !== FALSE) { curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); } else { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); } curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); $data = curl_exec($ch); curl_close($ch); return $data; } /** * [sign 签名] * @param null $app [不为null开启二次签名] * @return string */ protected function sign($params, $app = NULL) { ksort($params); foreach ($params as $key => $item) { if (!empty($item)) $newArr[] = $key . '=' . $item; } $stringA = implode("&", $newArr); $stringSignTemp = $stringA . "&key=" . $this->key; $sign = MD5($stringSignTemp); if (is_null($app)) $sign = strtoupper($sign); return $sign; } /** * [FromXml xml转数组] * @param $xml * @return bool|mixed */ public function FromXml($xml) { if (!$xml) return false; libxml_disable_entity_loader(true); $data = @json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $data; } /** * [ToXml 参数组装成xml] * @param array $data * @return bool|string */ public function ToXml($data = []) { if (!is_array($data) || count($data) <= 0) return false; $xml = "<xml>"; foreach ($data as $key => $val) { if (is_numeric($val)) { $xml .= "<" . $key . ">" . $val . "</" . $key . ">"; } else { $xml .= "<" . $key . "><![CDATA[" . $val . "]]></" . $key . ">"; } } $xml .= "</xml>"; return $xml; } /** * [rand_code 生成随机字符串] * @return bool|string */ protected function rand_code() { $str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';//62个字符 $str = str_shuffle($str); $str = substr($str, 0, 32); return $str; } /** * [orderQuery 查询订单] * @param $order [商户订单号] * @param $money [订单金额] * @return bool [false | 成功返回流水号] */ public function orderQuery($order, $money) { $url = 'https://api.mch.weixin.qq.com/pay/orderquery'; $data = array( 'appid' => $this->appId, 'mch_id' => $this->mch_id, 'nonce_str' => $this->nonce_str, 'out_trade_no' => $order ); $data['sign'] = $this->sign($data); $data = $this->curlWx($url, $this->ToXml($data)); if ($data) { $res = $this->FromXml($data); if ($res['return_code'] == 'FAIL') { return false; } else { // if (isset($res['return_code']) and $res['return_code'] == 'SUCCESS' and isset($res['return_msg']) and $res['return_msg'] == 'OK' and isset($res['result_code']) and $res['result_code'] == 'SUCCESS' and isset($res['trade_state']) and $res['trade_state'] == 'SUCCESS') { // if ($res['total_fee'] == ($money * 100)) { return $res['transaction_id']; } else { return false; } // } else { return false; } // } // } else { return false; } } }该类含有微信app支付 h5支付 公众号支付(jsapi) 订单查询native扫码支付后面会添加异步主要商户订单号查询 并确定金额是否与数据库中一致以及判断该商户订单号是否处理过(谨记)个人觉得验签并不重要 有订单查询以及数据库订单验证就行了过多的就不介绍了 源码有注释
2019年11月02日
13 阅读
0 评论
0 点赞
2019-10-11
【原创】2019云豹主播采集插件
效果怎么样我就不在叙述了为了防止此插件滥用接口加入授权 如需使用请赞助本站并联系博主本人赞助以及联系方式请在 关于 中查看点我下载 密码 i9IAmTNH
2019年10月11日
6 阅读
0 评论
0 点赞
2019-09-27
mysql对自增主键id进行重新排序
经过一段时间的添加和删除,mysql数据库表的自增量主键ID变得混乱,需要重新排列原理:删除原有的自增ID,重新建立新的自增ID。1.删除原有主键 ALTER TABLE `news` DROP `id`;2.添加新主键字段 ALTER TABLE `news` ADD `id` BIGINT(20) NOT NULL FIRST;3.设置新主键 ALTER TABLE `news` MODIFY COLUMN `id` BIGINT(20) NOT NULL AUTO_INCREMENT,ADD PRIMARY KEY(id);
2019年09月27日
12 阅读
0 评论
0 点赞
2019-09-23
Linux下通过rdesktop远程windows
linux下利用rdesktop命令远程连接windows博主本人使用的是centos7.4其它版本请自测 # yum install rdesktop -y # rdesktop -u administrator -d contoso -p 密码 IP -g 1920x1080 -D常用选项:-u:指定User;-d:指定域;-p:指定密码(不指定密码则在远程时输入);-g:指定分辨率;-D:远程后不显示标题栏;-f:远程后全屏显示桌面(ctrl+alt+enter退出全屏模式);-r disk:<sharename>=/home/superlong:将本机(Linux)上的/home/superlong目录映射到Win7上,传输文件更方便;-r clipboard:PRIMARYCLIPBOARD:Linux和Windows系统相互可以实现复制和粘贴(实际不添加此选项也可复制粘贴);
2019年09月23日
1 阅读
0 评论
0 点赞
2019-09-20
PHP采集短视频 无水印
因为一些原因需要采集短视频,要无水印的那种,没办法只好找了一个平台抓包看看思路:首先fd安卓抓包获取视频列表接口以及分页接口操作很庆幸的是抓到了通过post访问正常可惜的是并没有短视频地址,只有标题等一些参数,这个时候灵机一动找分享接口,众所周之网页端加密是不行的,只要能播放就能获取到视频地址,于是新的一轮开始了上图的url参数就是视频地址,访问ok,下面可以做采集操作了,代码如下:源码 <?php /** * @author anderyly * @email admin@aaayun.cc * @link https://blog.aaayun.cc/ * @copyright Copyright (c) 2019 */ set_time_limit(0); include_once "Curl.php"; include_once "Db.php"; $curl = new Curl(); $db = new Db(); $api = 'http://api.cray.inf.miui.com/content/videoList'; $page = 0; $header = [ 'Cookie' => 'UM_distinctid=16c8455b31b1c4-0dfaf82ea6a25f-30760d58-1fa400-16c8455b31c215; CNZZDATA1272902400=401331908-1565588304-%7C1565588304; CNZZDATA1277592072=1290948318-1565593164-%7C1565593164; Hm_lvt_d214947968792b839fd669a4decaaffc=1568015305,1568191237,1568269922,1568687357', ]; $i = 1; while (true) { $param = [ 'data' => '{"header":{"token":"","deviceId":"XWDyRwJadFYDAHnE+F5Hzlct","imeiMd5":"49A22D4E49F5B97EDFD236BA2173E37B","apkVersion":"2.0.0","apkChannel":"xiaomi"},"data":{"after":"0","pageNum":"' . $page . '"}}', ]; $res = $curl->url($api)->header($header)->param($param)->post(); if (!$res) { var_dump('video is null'); break; } $arr = json_decode($res, true); if (!isset($arr['data']['items'])) continue; $list = $arr['data']['items']; foreach ($list as $k => $v) { if (!isset($v['id'])) { var_dump('End'); exit; } $row = $db->name('video')->field('id')->where('cid', $v['id'])->find(); if ($row) continue; // 视频id $data['cid'] = $v['id']; // 视频发布时间 13位时间戳 $data['createTime'] = strtotime(date('Y-m-d H:i:s', $v['createTime'])); // 视频标题 $data['title'] = $v['videoInfo']['desc']; // 视频封面图 $data['vthumb'] = $v['videoInfo']['coverUrl']; $data['thumb'] = str_replace('http://cdn.cnbj1.fds.api.mi-img.com/', '/public/video/thumb/', $v['videoInfo']['coverUrl']); // 视频地址 $link = getVideo($v['id']); $data['vlink'] = $link; $data['link'] = str_replace('http://mic.w.xk.miui.com/', '/public/video/video/', $link); $data['page'] = $page; $db->name('video')->insert($data); var_dump($i); $i++; } $page++; } // 获取视频地址 function getVideo($id) { global $curl; global $header; if ($id == '') return false; $url = 'https://longxia.music.xiaomi.com/api/share?contentType=video&contentId=' . $id; $res = $curl->url($url)->header($header)->get(); $arr = json_decode($res, true); if (!isset($arr['data']['videoInfo']['contentType']) and $arr['data']['videoInfo']['contentType'] != 'VIDEO') return false; $videoInfo = $arr['data']['videoInfo']['videoInfo']; return $videoInfo['url']; }源码并没有作下载功能有需要的可以自己写
2019年09月20日
9 阅读
0 评论
0 点赞
1
...
8
9
10
...
19