Update webpagetool.php

This commit is contained in:
Namhyeon Go 2018-05-12 23:15:35 +09:00 committed by GitHub
parent 47cb1e5c39
commit 4ccf5b9d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,14 +59,17 @@ if(!function_exists("get_web_page")) {
$status = "-1"; $status = "-1";
$resno = "-1"; $resno = "-1";
$errno = "-1"; $errno = "-1";
if($method = "post.cmd" || $method == "get.cmd") { if($method == "post.cmd" || $method == "get.cmd") {
$content = get_web_cmd($url, $method, $data, $proxy, $ua, $ct_out, $t_out); $res_methods = explode(".", $method);
$content = get_web_cmd($url, $res_methods[0], $data, $proxy, $ua, $ct_out, $t_out);
} elseif($method == "get.fgc") { } elseif($method == "get.fgc") {
$content = get_web_fgc($url); $content = get_web_fgc($url);
} else { } else {
if(!in_array("curl", get_loaded_extensions())) { if(!in_array("curl", get_loaded_extensions())) {
return "cURL extension needs to be installed."; $error_msg = "cURL extension needs to be installed.";
set_error($error_msg);
return $error_msg;
} }
$options = array( $options = array(
@ -87,7 +90,7 @@ if(!function_exists("get_web_page")) {
); );
if(empty($options[CURLOPT_USERAGENT])) { if(empty($options[CURLOPT_USERAGENT])) {
$ua = "2018 ReasonableFramework;https://github.com/gnh1201/reasonableframework"; $ua = "2018 ReasonableFramework: https://github.com/gnh1201/reasonableframework";
$options[CURLOPT_USERAGENT] = $ua; $options[CURLOPT_USERAGENT] = $ua;
} }