Created
June 4, 2011 17:18
-
-
Save ytkhs/1008086 to your computer and use it in GitHub Desktop.
push notification to iPhone via im.kayac.com with password, and open Twitter.
This file contains hidden or 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 | |
define('USERNAME', 'xxxxxxxx'); | |
define('PASSWORD', 'xxxxxxxxxxxxxx'); | |
define('END_POINT', 'http://im.kayac.com/api/post/'.USERNAME); | |
$postMessage = urlencode('東京スカイツリーにきたよ!'); | |
$data = array( | |
'message' => 'Push from im.kayac.com', | |
'password' => PASSWORD, | |
'handler' => 'twitter://post?message='.$postMessage | |
); | |
$content = http_build_query($data, '', '&'); | |
//header | |
$header = array( | |
'Content-Type: application/x-www-form-urlencoded', | |
'Content-Length: '.strlen($content) | |
); | |
$context = array( | |
"http" => array( | |
'method' => 'POST', | |
'header' => implode("rn", $header), | |
'content' => $content | |
) | |
); | |
echo file_get_contents(END_POINT, false, stream_context_create($context)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment