This commit is contained in:
Namhyeon Go 2019-04-16 07:16:11 +00:00
parent cab583fd1c
commit c922ef2b80
4 changed files with 22 additions and 17 deletions

View File

@ -10,7 +10,7 @@
if(!check_function_exists("twilio_get_config")) {
function twilio_get_config() {
$config = get_config();
return array(
"sid" => get_value_in_array("twilio_sid", $config, ""),
"token" => get_value_in_array("twilio_token", $config, ""),
@ -28,7 +28,7 @@ if(!check_function_exists("twilio_send_message")) {
if(loadHelper("webpagetool")) {
$request_url = sprintf("https://api.twilio.com/2010-04-01/Accounts/%s/Messages.json", $sid);
$response = get_web_json($request_url, "post", array(
"headers" = array(
"headers" => array(
"Content-Type" => "application/x-www-form-urlencoded",
"Authentication" => array("Basic", $cnf['sid'], $cnf['token']),
),
@ -36,28 +36,28 @@ if(!check_function_exists("twilio_send_message")) {
"Body" => $message,
"From" => $cnf['from'],
"To" => $to,
),
);
)
));
}
return $response;
}
}
if(!check_function_exists("twilio_send_voice")) {
function twilio_send_voice($url="", $to) {
function twilio_send_voice($message="", $to) {
$response = false;
$cnf = twilio_get_config();
$url = "http://demo.twilio.com/docs/voice.xml";
var_dump($cnf);
if(empty($url)) {
$url = "http://demo.twilio.com/docs/voice.xml";
}
if(loadHelper("webpagetool")) {
$request_url = sprintf("https://api.twilio.com/2010-04-01/Accounts/%s/Calls.json", $sid);
$response = get_web_json($request_url, "post", array(
"headers" = array(
$request_url = sprintf("https://api.twilio.com/2010-04-01/Accounts/%s/Calls.json", $cnf['sid']);
$response = get_web_page($request_url, "post.cmd", array(
"headers" => array(
"Content-Type" => "application/x-www-form-urlencoded",
"Authentication" => array("Basic", $cnf['sid'], $cnf['token']),
),
@ -66,9 +66,11 @@ if(!check_function_exists("twilio_send_voice")) {
"From" => $cnf['from'],
"To" => $to,
),
);
));
var_dump($response);
}
return $response;
}
}

View File

@ -106,6 +106,7 @@ if(!check_function_exists("get_web_cmd")) {
}
}
}
$args[] = $url;
}
if($method == "jsondata") {
@ -124,6 +125,9 @@ if(!check_function_exists("get_web_cmd")) {
// complete and run command
$cmd = trim(implode(" ", $args));
var_dump($cmd);
if(!empty($cmd)) {
$output = exec_command($cmd, "shell_exec");
}

View File

@ -425,7 +425,7 @@ if(!check_function_exists("get_bind_to_sql_select")) {
foreach($options['setorders'] as $opts) {
if(check_is_string_not_array($opts)) {
$s4a[] = $opts;
} elseif(check_array_length($opts, 2) == 0)) {
} elseif(check_array_length($opts, 2) == 0) {
// example: array("desc", "datetime")
$s4a[] = sprintf("%s %s", $opts[1], $opts[0]);
}

View File

@ -155,7 +155,6 @@ if(!check_function_exists("read_requests")) {
"raw" => "_RAW",
"json" => "_JSON",
"seal" => "_SEAL",
"mixed" => "_MIXED",
);
foreach($aliases as $k=>$v) {
$requests[$k] = $requests[$v];
@ -269,7 +268,7 @@ if(!check_function_exists("get_requested_value")) {
if(is_array($method)) {
$req_methods = array_merge($req_methods, $method);
} else {
$req_methods[] = $mehtod;
$req_methods[] = $method;
}
$req_methods = array_reverse($req_methods);