-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkayac.php
44 lines (32 loc) · 883 Bytes
/
kayac.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*
sendKayac($message) … $messageに任意の文字列を設定
戻り値:0 正常
0以外 エラー
*/
Class ImKayac{
public function sendKayac($message) {
$data = array(
"message" => $message,
"sig" => ""
);
$data['sig'] = sha1($data['message'] . "yayoikawaii3255");
$data = http_build_query($data, "", "&");
$header = array(
"Content-Type: application/x-www-form-urlencoded",
"Content-Length: ".strlen($data)
);
$context = array(
"http" => array(
"method" => "POST",
"header" => implode("\r\n", $header),
"content" => $data
)
);
$url = "http://im.kayac.com/api/post/zishinbot";
$post_status_json = file_get_contents($url, false, stream_context_create($context));
$post_status = json_decode($post_status_json, true);
$ret = strcmp($post_status['result'], "posted");
return $ret;
}
}