Created
April 14, 2018 08:11
-
-
Save yyano/ea68e69c3190bee7959439a18811a143 to your computer and use it in GitHub Desktop.
GET/POSTとStreamのテスト用php
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 | |
$server = var_export( $_SERVER, true ); | |
file_put_contents( date('YmdHis')."_S.txt", var_export( $server,true ) ); | |
$method = $_SERVER['REQUEST_METHOD']; | |
if ($method == 'POST') { | |
$post = var_export( $_POST, true ); | |
file_put_contents( date('YmdHis')."_P.txt", var_export( $post,true ) ); | |
} | |
if ($method == 'GET') { | |
$post = var_export( $_GET, true ); | |
file_put_contents( date('YmdHis')."_G.txt", var_export( $post,true ) ); | |
} | |
if ($method == 'GET') { | |
$hubmode = $_REQUEST['hub_mode']; | |
$hubchallenge = $_REQUEST['hub_challenge']; | |
if ($hubmode == 'subscribe' || $hubmode == 'unsubscribe') { | |
// response a challenge code to the HUB | |
header('HTTP/1.1 200 "OK"', null, 200); | |
header('Content-Type: text/plain'); | |
echo $hubchallenge; | |
} else { | |
header('HTTP/1.1 404 "Not Found"', null, 404); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment