public static function notify($arr, $config) { $resParam = array("version" => $config['version'], "charset" => $config['charset'], "signMethod" => $config['signMethod'], "successLable" => ''); $merchantKey = $config['merchantKey']; $sign_method = strtolower(str_replace('-', '', $config['signMethod'])); if (empty($arr['signature'])) { $resParam['successLable'] = 'signature参数不能为空!'; } else { if (self::validateSign($arr, $merchantKey)) { $param = array(); $param['signMethod'] = 'SHA-256'; $param['transType'] = '004'; $param['merchantId'] = $arr['merchantId']; $param['notifyId'] = $arr['notifyId']; ksort($param); $param['signature'] = hash($sign_method, self::get_http_query($param) . $merchantKey); //var_dump($param);die; $http = Http::factory(Http::TYPE_STREAM); $resPost = $http->post($config['postUrl'], $param); //var_dump($resPost);die; if ($resPost == 'TRUE') { $resParam['successLable'] = "S"; } else { $resParam['successLable'] = "N"; } } else { $resParam['successLable'] = 'N'; } } ksort($resParam); $resParam['signature'] = hash($sign_method, self::get_http_query($resParam) . $merchantKey); return http_build_query($resParam, '', '&'); }
<?php /** * 商户查询功能demo * $Author: zhaoshuangxi */ error_reporting(0); require "config.php"; require "http.php"; require "merchant.class.php"; $http = Http::factory(Http::TYPE_STREAM); $arr = array("version" => $config['version'], "charset" => $config['charset'], "signMethod" => $config['signMethod'], "transType" => "005", "merId" => $config['merchantId'], "merchantKey" => $config['merchantKey'], "mercOrderNo" => "1234500026", "signature" => ""); $arr['signature'] = Merchant::sign($arr); $res = $http->post($config['postUrl'], $arr); print $res;
define('DOC_ROOT', dirname(__FILE__)); $action = isset($_GET['action']) ? $_GET['action'] : ''; if ($action == 'go') { $emlog_zip = $_POST['emlog_zip']; if (empty($emlog_zip)) { die('压缩包地址为空'); } $http = null; try { $http = Http::factory($emlog_zip, Http::TYPE_CURL); } catch (Exception $e) { try { $http = Http::factory($emlog_zip, Http::TYPE_SOCK); } catch (Exception $e) { try { $http = Http::factory($emlog_zip, Http::TYPE_STREAM); } catch (Exception $e) { die('您空间的PHP不支持远程下载.'); } } } if (!$http) { die('您空间的PHP不支持远程下载.'); } try { $data = $http->send(); } catch (Exception $e) { echo '下载EMLOG压缩包时出现错误: <br>'; echo $e->getMessage(); die; }