Update webpagetool.php
This commit is contained in:
parent
d524fe30fc
commit
4a971e232a
|
|
@ -47,6 +47,12 @@ if(!function_exists("get_web_cmd")) {
|
||||||
$cmd_fin = "";
|
$cmd_fin = "";
|
||||||
$cmd = "";
|
$cmd = "";
|
||||||
|
|
||||||
|
$headers = array();
|
||||||
|
if(is_array("headers", $data)) {
|
||||||
|
$headers = $data['headers'];
|
||||||
|
unset($data['headers']);
|
||||||
|
}
|
||||||
|
|
||||||
if(!loadHelper("exectool")) {
|
if(!loadHelper("exectool")) {
|
||||||
set_error("Helper exectool is required");
|
set_error("Helper exectool is required");
|
||||||
show_errors();
|
show_errors();
|
||||||
|
|
@ -73,9 +79,16 @@ if(!function_exists("get_web_cmd")) {
|
||||||
if($method == "jsondata") {
|
if($method == "jsondata") {
|
||||||
$cmd = "curl -A '%s' --header 'Content-Type: application/json' --request POST --data '%s' %s";
|
$cmd = "curl -A '%s' --header 'Content-Type: application/json' --request POST --data '%s' %s";
|
||||||
$cmd_fin = sprintf($cmd, make_safe_argument($ua), json_encode($data), $url);
|
$cmd_fin = sprintf($cmd, make_safe_argument($ua), json_encode($data), $url);
|
||||||
$output = exec_command($cmd_fin, "shell_exec");
|
}
|
||||||
|
|
||||||
|
// process http headers
|
||||||
|
if(count($headers) > 0) {
|
||||||
|
foreach($headers as $k=>$v) {
|
||||||
|
$cmd_fin .= sprintf("-H '%s: %s' ", make_safe_argument($k), make_safe_argument($v));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exec command
|
||||||
if(!empty($cmd_fin)) {
|
if(!empty($cmd_fin)) {
|
||||||
$output = exec_command($cmd_fin, "shell_exec");
|
$output = exec_command($cmd_fin, "shell_exec");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user