<?php
/**
 * [UQcms System] Copyright uqcms.com
 * QQ: 2200631718
 * Author: gj.name
 * This is NOT a freeware
*/  defined('IN_UQ') or exit('Access Denied'); class express { function __construct(){ } function json_utf8($value){ if (version_compare(PHP_VERSION,'5.4.0','<')){ $str = json_encode($value); $str = preg_replace_callback("#\\\u([0-9a-f]{4})#i",function($matchs){ return iconv('UCS-2BE', 'UTF-8', pack('H4', $matchs[1])); },$str); return $str; }else{ return json_encode($value, JSON_UNESCAPED_UNICODE); } } function submitEOrder($requestData){ $datas = array( 'RequestData' => urlencode($requestData) , 'EBusinessID' => $this->EBusinessID, 'RequestType' => '1007', 'DataType' => '2', ); $datas['DataSign'] = $this->encrypt($requestData, $this->AppKey); $result=$this->sendPost($this->ReqURL, $datas); return $result; } function sendPost($url, $datas) { $temps = array(); foreach ($datas as $key => $value) { $temps[] = sprintf('%s=%s', $key, $value); } $post_data = implode('&', $temps); $url_info = parse_url($url); if(empty($url_info['port'])){ $url_info['port']=80; } $httpheader = "POST " . $url_info['path'] . " HTTP/1.0\r\n"; $httpheader.= "Host:" . $url_info['host'] . "\r\n"; $httpheader.= "Content-Type:application/x-www-form-urlencoded\r\n"; $httpheader.= "Content-Length:" . strlen($post_data) . "\r\n"; $httpheader.= "Connection:close\r\n\r\n"; $httpheader.= $post_data; $fd = fsockopen($url_info['host'], $url_info['port']); fwrite($fd, $httpheader); $gets = ""; $headerFlag = true; while(!feof($fd)){ if(($header = @fgets($fd)) && ($header == "\r\n" || $header == "\n")){ break; } } while(!feof($fd)){ $gets.= fread($fd, 128); } fclose($fd); return $gets; } function encrypt($data, $appkey) { return urlencode(base64_encode(md5($data.$appkey))); } }