Update webpagetool.php

This commit is contained in:
Namhyeon Go 2018-05-29 17:31:24 +09:00 committed by GitHub
parent cf557f2101
commit d26e77c4a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,6 +164,7 @@ if(!function_exists("get_web_page")) {
$status = "-1"; $status = "-1";
$resno = "-1"; $resno = "-1";
$errno = "-1"; $errno = "-1";
$req_method = $method;
$method = strtolower($method); $method = strtolower($method);
$res_methods = explode(".", $method); $res_methods = explode(".", $method);
@ -221,9 +222,9 @@ if(!function_exists("get_web_page")) {
$content = curl_exec($ch); $content = curl_exec($ch);
if(!is_string($content)) { if(!is_string($content)) {
$res_method = $method . ".cmd"; $res = get_web_page($url, $method . ".cmd", $data, $proxy, $ua, $ct_out, $t_out);
$res = get_web_page($url, $res_method, $data, $proxy, $ua, $ct_out, $t_out);
$content = $res['content']; $content = $res['content'];
$req_method = $res['method'];
} else { } else {
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$resno = curl_getinfo($ch, CURLINFO_RESPONSE_CODE); $resno = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
@ -253,6 +254,8 @@ if(!function_exists("get_web_page")) {
"gz_md5" => get_hashed_text($gz_content, "md5"), "gz_md5" => get_hashed_text($gz_content, "md5"),
"gz_sha1" => get_hashed_text($gz_content, "sha1"), "gz_sha1" => get_hashed_text($gz_content, "sha1"),
"gz_ratio" => $gz_ratio, "gz_ratio" => $gz_ratio,
"method" => $req_method,
"params" => $data,
); );
return $response; return $response;
@ -296,7 +299,7 @@ if(!function_exists("get_web_cache")) {
if(!function_exists("get_web_json")) { if(!function_exists("get_web_json")) {
function get_web_json($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_json($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$result = array(); $result = false;
$response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out); $response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out);
if($response['size'] > 0) { if($response['size'] > 0) {