Skip to content

Instantly share code, notes, and snippets.

@yyano
Created April 14, 2018 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yyano/ea68e69c3190bee7959439a18811a143 to your computer and use it in GitHub Desktop.
Save yyano/ea68e69c3190bee7959439a18811a143 to your computer and use it in GitHub Desktop.
GET/POSTとStreamのテスト用php
<?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