Update webpagetool.php

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

View File

@ -6,8 +6,8 @@
* @brief WebPageTool helper * @brief WebPageTool helper
*/ */
if(!function_exists("get_web_legacy")) { if(!function_exists("get_web_fgc")) {
function get_web_legacy($url) { function get_web_fgc($url) {
return (ini_get("allow_url_fopen") ? file_get_contents($url) : false); return (ini_get("allow_url_fopen") ? file_get_contents($url) : false);
} }
} }
@ -62,14 +62,15 @@ if(!function_exists("get_web_page")) {
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); $content = get_web_cmd($url, $method, $data, $proxy, $ua, $ct_out, $t_out);
echo $content; } elseif($method == "get.fgc") {
$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."; return "cURL extension needs to be installed.";
} }
$options = array( $options = array(
CURLOPT_URL => $url, // set url CURLOPT_URL => $url, // set remote url
CURLOPT_PROXY => $proxy, // set proxy server CURLOPT_PROXY => $proxy, // set proxy server
CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers CURLOPT_HEADER => false, // don't return headers