function sendPostInfo($para_temp, $gateway, $aliapy_config) { $xml_str = ''; $request_data = $this->buildRequestParaToString($para_temp, $aliapy_config); $url = $gateway . $request_data; $xml_data = getHttpResponse($url, trim(strtolower($aliapy_config['input_charset']))); $doc = new DOMDocument(); $doc->loadXML($xml_data); return $doc; }
/** * 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数 * 注意:若要使用远程HTTP获取数据,必须开通SSL服务,该服务请找到php.ini配置文件设置开启,建议与您的网络管理员联系解决。 * return 时间戳字符串 */ function query_timestamp() { $url = $this->alipay_gateway_new . "service=query_timestamp&partner=" . trim($this->aliapy_config['partner']); $encrypt_key = ""; //获取远程数据 $xml_data = getHttpResponse($url); //解析XML数据 $para_data = @XML_unserialize($xml_data); //获取时间戳 $encrypt_key = $para_data['alipay']['response']['timestamp']['encrypt_key']; return $encrypt_key; }
/** * 构造模拟远程HTTP的POST请求,获取支付宝的返回XML处理结果 * @param $para_temp 请求参数数组 * @param $gateway 网关地址 * @param $aliapy_config 基本配置信息数组 * @return 支付宝返回XML处理结果 */ function sendPostInfo($para_temp, $gateway, $aliapy_config) { $xml_str = ''; //待请求参数数组字符串 $request_data = $this->buildRequestParaToString($para_temp, $aliapy_config); //请求的url完整链接 $url = $gateway . $request_data; //远程获取数据 $xml_data = getHttpResponse($url, trim(strtolower($aliapy_config['input_charset']))); //解析XML $para_data = @XML_unserialize($xml_data); return $para_data; }
function getResponse($notify_id) { $transport = strtolower(trim($this->aliapy_config['transport'])); $partner = trim($this->aliapy_config['partner']); $veryfy_url = ''; if ($transport == 'https') { $veryfy_url = $this->https_verify_url; } else { $veryfy_url = $this->http_verify_url; } $veryfy_url = $veryfy_url . "partner=" . $partner . "¬ify_id=" . $notify_id; $responseTxt = getHttpResponse($veryfy_url); return $responseTxt; }
debug(__LINE__); $ok = false; $host = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : 'localhost'; $port = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80; $pr = array(GM('HTACCESS'), GM('HTACCESS_D'), 1); if ($bTest && $file && $dir && prepare_htaccess_test()) { if ($socket) { $res = fsockopen(($port == 443 ? 'ssl://' : '') . $host, $port, $errno, $errstr, 3); } else { $res = false; } if ($res) { $strRequest = "GET " . dirname($_SERVER['PHP_SELF']) . "/bitrix_htaccess_test/test_file.php HTTP/1.1\r\n"; $strRequest .= "Host: " . $host . "\r\n"; $strRequest .= "\r\n"; $strRes = getHttpResponse($res, $strRequest); fclose($res); if (false !== strpos($strRes, "SUCCESS")) { $val = $ok = GM('YES'); } else { $val = GM('NO'); } } else { $val = GM('NO_CONNECT'); } show($pr, $val, !$ok); clear_htaccess_test(); } else { show($pr, GM('NOT_TESTED'), 1); } // Filesystem benchmark
/** * 获取远程服务器ATN结果,验证返回URL * @param $notify_id 通知校验ID * @return 服务器ATN结果 * 验证结果集: * invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空 * true 返回正确信息 * false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟 */ function getResponse($notify_id) { $transport = strtolower(trim($this->aliapy_config['transport'])); $partner = trim($this->aliapy_config['partner']); $veryfy_url = ''; if ($transport == 'https') { $veryfy_url = $this->https_verify_url; } else { $veryfy_url = $this->http_verify_url; } $veryfy_url = urldecode($veryfy_url) . "partner=" . $partner . "¬ify_id=" . $notify_id; if (substr($veryfy_url, 0, 3) == "") { $veryfy_url = substr_replace($veryfy_url, '', 0, 3); } $responseTxt = getHttpResponse($veryfy_url); return $responseTxt; }