forked from eunicebes/emotion_Map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandler.php
24 lines (20 loc) · 1.21 KB
/
handler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
date_default_timezone_set('Asia/Taipei');
$response = file_get_contents('php://input');
$obj = json_decode($response);
$id = $obj->{'id'};
$posts = $obj->{'posts'};
// echo json_encode($posts);
$query_string = json_encode($posts);
$ch = curl_init('http://140.114.77.18:5678/emomap/couple');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($query_string))
);
$result = curl_exec($ch);
// $result = json_decode($result);
echo $result;
?>