im.kayac.com post test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// im.kayac.com 送信テスト | |
$api_url = "http://im.kayac.com/api/post/あなたのユーザ名"; | |
$password = "設定したパスワード"; | |
// $secret_key = "設定した秘密鍵"; | |
$message = "日本語メッセージテスト!\n改行あるとどうなる?"; | |
$content = http_build_query(array( | |
"message" => $message, | |
"password" => $password, | |
// "sig" => sha1("{$message}{$secret_key}"), // 秘密鍵認証する場合はこっち | |
)); | |
$header = array( | |
"Content-Type: application/x-www-form-urlencoded", | |
"Content-Length: " . strlen($content), | |
); | |
$response = file_get_contents($api_url, false, stream_context_create(array( | |
"http" => array( | |
"method" => "POST", | |
"header" => implode("\r\n", $header), | |
"content" => $content, | |
), | |
))); | |
var_dump($response); | |
// string(40) "{"error":"","id":null,"result":"posted"}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment