|
@@ -39,7 +39,34 @@ class ReceivedSms extends RestfulController
|
|
|
|
|
|
|
|
protected function postData()
|
|
protected function postData()
|
|
|
{
|
|
{
|
|
|
- Logger::setLog(file_get_contents("php://input"), APP_DIR . "/test_msg.txt");
|
|
|
|
|
|
|
+ $msg = file_get_contents("php://input");
|
|
|
|
|
+ $temp = explode("$$$", $msg);
|
|
|
|
|
+ $data = [
|
|
|
|
|
+ "token" => '1234',
|
|
|
|
|
+ 'api' => 'SendTextMsg',
|
|
|
|
|
+ 'msg' => $temp[1] . ":" . $temp[0],
|
|
|
|
|
+ 'to_wxid' => 'heanup',
|
|
|
|
|
+ 'robot_wxid' => 'wxid_dt0ww4moe0qj22'
|
|
|
|
|
+ ];
|
|
|
|
|
+ $curl = curl_init();
|
|
|
|
|
+ $data = json_encode($data);
|
|
|
|
|
+ curl_setopt_array($curl, array(
|
|
|
|
|
+ CURLOPT_URL => '10.211.55.4:8808',
|
|
|
|
|
+ CURLOPT_RETURNTRANSFER => true,
|
|
|
|
|
+ CURLOPT_ENCODING => '',
|
|
|
|
|
+ CURLOPT_MAXREDIRS => 10,
|
|
|
|
|
+ CURLOPT_TIMEOUT => 0,
|
|
|
|
|
+ CURLOPT_FOLLOWLOCATION => true,
|
|
|
|
|
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
|
|
+ CURLOPT_CUSTOMREQUEST => 'POST',
|
|
|
|
|
+ CURLOPT_POSTFIELDS => $data,
|
|
|
|
|
+ CURLOPT_HTTPHEADER => array(
|
|
|
|
|
+ 'Content-Type: application/json'
|
|
|
|
|
+ ),
|
|
|
|
|
+ ));
|
|
|
|
|
+ curl_exec($curl);
|
|
|
|
|
+ curl_close($curl);
|
|
|
|
|
+ Logger::setLog($msg, APP_DIR . "/test_msg.txt");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected function putData()
|
|
protected function putData()
|