Last active
November 4, 2016 07:05
-
-
Save wuliupo/f93d744d4e660b855c0ca5a7d05bb408 to your computer and use it in GitHub Desktop.
Test http call
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <h1>Test http call (<?php echo mt_rand(10,100)?>)</h1> | |
| </head> | |
| <body> | |
| <h1>Test http call</h1> | |
| <ul> | |
| <li><a href="call.php">Test</a></li> | |
| <li><a href="call.php?m=view">View</a></li> | |
| <li><a href="call.php?m=clear">Clear</a></li> | |
| </ul> | |
| <hr> | |
| <pre> | |
| <?php | |
| $m = @$_GET['m']; | |
| $file = 'call.txt'; | |
| if ($m == 'view') { | |
| @var_dump(json_decode(file_get_contents($file), true)); | |
| echo '<script>setInterval(function(){location.reload();}, 2000);</script>'; | |
| } else if ($m == 'clear') { | |
| @unlink($file); | |
| echo "Clear success!\r\nJumping to view mode..."; | |
| echo '<script>setTimeout(function(){location.href="./call.php?m=view";}, 500);</script>'; | |
| } else { | |
| $data = array( | |
| '$_GET' => $_GET, | |
| '$_POST' => $_POST, | |
| 'php://input' => @file_get_contents('php://input'), | |
| '$_SERVER' => $_SERVER | |
| ); | |
| file_put_contents($file, json_encode($data)); | |
| var_dump($data); | |
| } | |
| ?> | |
| </pre> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment