Update webpagetool.php

This commit is contained in:
Namhyeon Go 2020-02-07 15:38:27 +09:00 committed by GitHub
parent 7e836f5615
commit 042e6f4226
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,14 +123,22 @@ if(!check_function_exists("get_web_cmd")) {
$args[] = $url;
}
if($method == "jsondata") {
$_data = json_encode($data);
if($method == "jsondata" || $method == "rawdata") {
$args[] = "-X POST"; // set post request (the same as -X)
$args[] = sprintf("-A '%s'", get_web_user_agent($ua)); // set agent
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
$headers['Content-Type'] = "application/json;charset=utf-8";
$headers['Accept'] = "application/json, text/plain, */*";
if($method == "jsondata") {
$_data = json_encode($data);
$headers['Content-Type'] = "application/json;charset=utf-8";
$headers['Accept'] = "application/json, text/plain, */*";
} else {
$headers['Content-Type'] = "text/plain"; // possible: application/octet-stream (RFC2046)
}
// get content size
$headers['Content-Length'] = strlen($_data);
foreach($headers as $k=>$v) {
// the same as --header
if(is_array($v)) {