Created
August 17, 2018 16:10
-
-
Save gollilla/9ef718b9ec6696ffeea1c477bb919d92 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<?php | |
define("SECRET", ''); | |
$url = "https://misskey.xyz/api/auth/session/generate"; | |
$data = [ | |
'appSecret' => SECRET | |
]; | |
post($url, $data); | |
function post($url, $data){ | |
$curl=curl_init($url); | |
$data = json_encode($data); | |
curl_setopt($curl,CURLOPT_POST, TRUE); | |
curl_setopt($curl,CURLOPT_POSTFIELDS, $data); | |
//curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); | |
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER, FALSE); | |
curl_setopt($curl,CURLOPT_SSL_VERIFYHOST, FALSE); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl,CURLOPT_COOKIEJAR, 'cookie'); | |
curl_setopt($curl,CURLOPT_COOKIEFILE, 'tmp'); | |
curl_setopt($curl,CURLOPT_FOLLOWLOCATION, TRUE); | |
//curl_setopt($curl,CURLOPT_REFERER, "REFERER"); | |
//curl_setopt($curl,CURLOPT_USERAGENT, "USER_AGENT"); | |
$res = curl_exec($curl); | |
$res = json_decode($res, true); | |
//header("Location: " . $res["url"]); | |
echo "<script type='text/javascript'> var win = window.open('" . $res["url"] . "', 'newwindow', 'width=800,height=700'); </script>"; | |
} | |
?> | |
<button class="submit">認証完了</button> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment