Update webpagetool.php

This commit is contained in:
Namhyeon Go 2018-11-26 20:26:11 +09:00 committed by GitHub
parent e8579de2fd
commit bee956c8d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,15 +86,22 @@ if(!function_exists("get_web_cmd")) {
$args[] = "-X POST"; // set post request (the same as -X)
$args[] = sprintf("-A '%s'", make_safe_argument($ua)); // set agent
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
$headers['Content-Type'] = "application/json";
foreach($headers as $k=>$v) {
$args[] = sprintf("--header '%s: %s'", make_safe_argument($k), make_safe_argument($v));
}
$args[] = sprintf("-d '%s'", json_encode($data));
$args[] = sprintf("--data '%s'", json_encode($data));
$args[] = $url;
}
// complete and run command
$cmd = trim(implode(" ", $args));
var_dump($cmd);
//exit;
if(!empty($cmd)) {
$output = exec_command($cmd, "shell_exec");
}
@ -280,6 +287,11 @@ if(!function_exists("get_web_page")) {
$content = false;
$req_method = $method;
// set user agent
if(empty($ua)) {
$ua = "github://gnh1201/reasonableframework";
}
// redefine data
$headers = array();
if(array_key_is_array("headers", $data)) {