190 lines
7.1 KiB
PHP
Executable File
190 lines
7.1 KiB
PHP
Executable File
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||
// +----------------------------------------------------------------------
|
||
// | Author: liu21st <liu21st@gmail.com>
|
||
// +----------------------------------------------------------------------
|
||
// 检测PHP环境
|
||
if(version_compare(PHP_VERSION,'5.4.0','<')) die('require PHP > 5.4.0 !');
|
||
//进入安装目录
|
||
if(is_dir("install") && !file_exists("install/install.ok")){
|
||
header("Location:install/index.php");
|
||
exit();
|
||
}
|
||
// function doHttpPost($url, $data){
|
||
|
||
|
||
// $data_string = json_encode($data);
|
||
|
||
// $result = file_get_contents($url, null, stream_context_create(array(
|
||
// 'http' => array(
|
||
// 'method' => 'POST',
|
||
// 'header' => 'Content-Type: application/json' . "\r\n"
|
||
// . 'Content-Length: ' . strlen($data_string) . "\r\n",
|
||
// 'content' => $data_string,
|
||
// ),
|
||
// )));
|
||
// return $result;
|
||
|
||
// // $ch = curl_init();
|
||
// // $this_header = array(
|
||
// // "content-type: application/json;"
|
||
// // );
|
||
// // curl_setopt($ch,CURLOPT_HTTPHEADER,$this_header);
|
||
// // curl_setopt($ch, CURLOPT_URL, $url);
|
||
// // curl_setopt($ch, CURLOPT_POST, true);
|
||
// // curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||
// // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||
// // curl_setopt($ch, CURLOPT_TIMEOUT, 120);
|
||
// // $output = curl_exec($ch);
|
||
// // curl_close($ch);
|
||
// // return $output;
|
||
// }
|
||
|
||
// function curl_request($url,$post='',$cookie='', $returnCookie=0){
|
||
// $curl = curl_init();
|
||
|
||
// curl_setopt($curl, CURLOPT_URL, $url);
|
||
// $this_header = array(
|
||
// "content-type: application/json;"
|
||
// );
|
||
// curl_setopt($curl,CURLOPT_HTTPHEADER,$this_header);
|
||
// curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)');
|
||
// curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
|
||
// curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
|
||
// curl_setopt($curl, CURLOPT_REFERER, "http://XXX");
|
||
// if($post) {
|
||
// curl_setopt($curl, CURLOPT_POST, 1);
|
||
// curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
|
||
// }
|
||
// if($cookie) {
|
||
// curl_setopt($curl, CURLOPT_COOKIE, $cookie);
|
||
// }
|
||
// curl_setopt($curl, CURLOPT_HEADER, $returnCookie);
|
||
// curl_setopt($curl, CURLOPT_TIMEOUT, 10);
|
||
// curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||
// $data = curl_exec($curl);
|
||
// if (curl_errno($curl)) {
|
||
// return curl_error($curl);
|
||
// }
|
||
// curl_close($curl);
|
||
// if($returnCookie){
|
||
// list($header, $body) = explode("\r\n\r\n", $data, 2);
|
||
// preg_match_all("/Set\-Cookie:([^;]*);/", $header, $matches);
|
||
// $info['cookie'] = substr($matches[1][0], 1);
|
||
// $info['content'] = $body;
|
||
// return $info;
|
||
// }else{
|
||
// return $data;
|
||
// }
|
||
// }
|
||
// function doHttpPostPayload($url, $data){
|
||
|
||
|
||
// $data_string = json_encode($data);
|
||
|
||
// //return $data_string;
|
||
|
||
// $ch = curl_init($url);
|
||
|
||
// $headers = array();
|
||
// $headers[] = 'Accept: application/json, text/plain, */*';
|
||
// $headers[] = 'Accept-Encoding: gzip, deflate';
|
||
// $headers[] = 'Accept-Language: zzh-CN,zh;q=0.9';
|
||
// $headers[] = 'Connection: keep-alive';
|
||
// $headers[] = 'Host: explorer.moac.io';
|
||
// $headers[] = 'Origin: explorer.moac.io';
|
||
// $headers[] = 'Referer: http://explorer.moac.io/token/0x4c7e99ee6fa3103bfd7f44d3d196fcbf52af988e';
|
||
// $headers[] = 'Content-Type: application/json; charset=utf-8';
|
||
// $headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36';
|
||
|
||
|
||
|
||
|
||
// curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||
// curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
||
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||
// curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||
// curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||
// curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
||
|
||
// //execute post
|
||
// $response = curl_exec($ch);
|
||
|
||
// //close connection
|
||
// curl_close($ch);
|
||
|
||
// return $response;
|
||
// // $curl = curl_init();
|
||
// // curl_setopt_array($curl, array(
|
||
// // CURLOPT_HTTPHEADER => array("application/json;charset=UTF-8"),
|
||
// // CURLOPT_URL => $url,
|
||
// // CURLOPT_RETURNTRANSFER => true,
|
||
// // CURLOPT_POST=>true,
|
||
// // CURLOPT_ENCODING => "",
|
||
// // CURLOPT_MAXREDIRS => 10,
|
||
// // CURLOPT_TIMEOUT => 30,
|
||
// // CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||
// // CURLOPT_CUSTOMREQUEST => "POST",
|
||
// // CURLOPT_POSTFIELDS => $data));
|
||
|
||
// // $response = curl_exec($curl);
|
||
// // $err = curl_error($curl);
|
||
|
||
// // curl_close($curl);
|
||
// // return $err;
|
||
// }
|
||
|
||
// $post_data = array('action' => 'tokenTransfer', 'address' => '0x4c7e99ee6fa3103bfd7f44d3d196fcbf52af988e', 'lastId' => '0', 'pageNum' => '1', 'pageSize' => '20');
|
||
// $url = 'http://explorer.moac.io/tokenrelay';
|
||
// //$post_data=json_encode($post_data);
|
||
// $result = curl_request($url, json_encode($post_data));//'action="tokenTransfer"&address="0x4c7e99ee6fa3103bfd7f44d3d196fcbf52af988e"&pageNum=2&pageSize=20');//&pageNum=1&pageSize=10
|
||
|
||
// var_dump($result);die;
|
||
// // $url = 'http://explorer.moac.io/transfer';
|
||
// // $post_data = array('draw' => '1', 'search[regex]' => 'False', 'addr' => '0x86fef829fe299ce684a185ee87b1c754f6a99ab7');
|
||
// // $result = doHttpPost($url, 'draw=1&search[regex]=False&addr=0x86fef829fe299ce684a185ee87b1c754f6a99ab7&start=0&length=10');//&start=0&length=20
|
||
|
||
// // $result=json_decode($result);
|
||
// // //var_dump($result);die;
|
||
// // echo '<pre />';
|
||
// // $block_data=[];
|
||
// // //0:交易哈希 1、时间戳 2、区块号 3、发送人地址 4、接收人地址 5、代币数量 6、代币名称 7、代币合约地址
|
||
// // foreach ($result->data as $key=>$val) {
|
||
|
||
// // $block_data[$key]['transfer_hash']=$val['0'];
|
||
// // $block_data[$key]['create_time']=date('Y-m-d H:i:s',$val['1']);
|
||
// // $block_data[$key]['block_num']=$val['2'];
|
||
// // $block_data[$key]['from_account']=$val['3'];
|
||
// // $block_data[$key]['to_account']=$val['4'];
|
||
// // $block_data[$key]['transfer_num']=$val['5'];
|
||
// // $block_data[$key]['coin_name']=$val['6'];
|
||
|
||
// // }
|
||
// //var_dump($block_data);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// die;
|
||
// [ 应用入口文件 ]
|
||
// 定义应用目录
|
||
define('APP_NAMESPACE','wstmart');
|
||
define('APP_PATH', __DIR__ . '/hyhproject/');
|
||
define('CONF_PATH', __DIR__.'/hyhproject/common/conf/');
|
||
define('WST_COMM', __DIR__.'/hyhproject/common/common/');
|
||
define('WST_HOME_COMM', __DIR__.'/hyhproject/home/common/');
|
||
define('WST_ADMIN_COMM', __DIR__.'/hyhproject/admin/common/');
|
||
define('WST_WECHAT_COMM', __DIR__.'/hyhproject/wechat/common/');
|
||
// 加载框架引导文件
|
||
require __DIR__ . '/thinkphp/start.php';
|