Update webpagetool.php
This commit is contained in:
parent
e8579de2fd
commit
bee956c8d0
|
|
@ -86,15 +86,22 @@ if(!function_exists("get_web_cmd")) {
|
||||||
$args[] = "-X POST"; // set post request (the same as -X)
|
$args[] = "-X POST"; // set post request (the same as -X)
|
||||||
$args[] = sprintf("-A '%s'", make_safe_argument($ua)); // set agent
|
$args[] = sprintf("-A '%s'", make_safe_argument($ua)); // set agent
|
||||||
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
|
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
|
||||||
|
$headers['Content-Type'] = "application/json";
|
||||||
foreach($headers as $k=>$v) {
|
foreach($headers as $k=>$v) {
|
||||||
$args[] = sprintf("--header '%s: %s'", make_safe_argument($k), make_safe_argument($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;
|
$args[] = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// complete and run command
|
// complete and run command
|
||||||
$cmd = trim(implode(" ", $args));
|
$cmd = trim(implode(" ", $args));
|
||||||
|
|
||||||
|
var_dump($cmd);
|
||||||
|
|
||||||
|
//exit;
|
||||||
|
|
||||||
|
|
||||||
if(!empty($cmd)) {
|
if(!empty($cmd)) {
|
||||||
$output = exec_command($cmd, "shell_exec");
|
$output = exec_command($cmd, "shell_exec");
|
||||||
}
|
}
|
||||||
|
|
@ -280,6 +287,11 @@ if(!function_exists("get_web_page")) {
|
||||||
$content = false;
|
$content = false;
|
||||||
$req_method = $method;
|
$req_method = $method;
|
||||||
|
|
||||||
|
// set user agent
|
||||||
|
if(empty($ua)) {
|
||||||
|
$ua = "github://gnh1201/reasonableframework";
|
||||||
|
}
|
||||||
|
|
||||||
// redefine data
|
// redefine data
|
||||||
$headers = array();
|
$headers = array();
|
||||||
if(array_key_is_array("headers", $data)) {
|
if(array_key_is_array("headers", $data)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user