Created
June 23, 2018 08:04
-
-
Save JRMorris77/6dcf46e44c819a5e61ab4a07fe7b29b8 to your computer and use it in GitHub Desktop.
Hummingbird API Quick Diagnostics
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 | |
/** | |
* Script Name: Hummingbird API Quick Diagnostics | |
* Script URI: https://premium.wpmudev.org/ | |
* Description: Misc diagnostic tools used by WPMU DEV SLS Tech Support | |
* Author: James Morris @ WPMU DEV | |
* Version: 0.1 | |
* Author URI: https://premium.wpmudev.org/ | |
* | |
*/ | |
error_reporting(E_ALL); | |
ini_set('display_errors', 1); | |
$realIP = file_get_contents("http://ipecho.net/plain"); | |
?> | |
<!DOCTYPE html> | |
<head> | |
<meta name="robots" content="noindex, nofollow" /> | |
<title>Hummingbird API Quick Diagnostics</title> | |
<style type="text/css" media="screen"> | |
body{ | |
padding:0px; | |
margin:0px; | |
text-align:left; | |
font-size:12px; | |
font-family:"Lucida Console", Monaco, monospace; | |
} | |
#content{ | |
padding:1em 2em; | |
} | |
pre{ | |
height:250px; | |
overflow:scroll; | |
background:#efefef; | |
border:1px solid silver; | |
padding:0 1em; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="content"> | |
<h1>Hummingbird API Quick Diagnostics</h1> | |
<hr /> | |
<h2>Server IP: <?php echo $_SERVER['SERVER_ADDR']; ?></h2> | |
<h2>Outbound IP (<em>may differ from Server IP</em>): <?php echo $realIP; ?></h2> | |
<h2>cURL Response</h2> | |
<pre><?php | |
$ch = curl_init('https://m9gnuc7j4d.execute-api.us-east-1.amazonaws.com/hummingbird/'); | |
curl_setopt($ch, CURLOPT_CONNECT_ONLY, true); | |
curl_exec($ch); | |
$getinfo = curl_getinfo($ch); | |
$out = ''; | |
foreach ($getinfo as $key => $value) { | |
$title = "<strong>" . $key . "</strong>"; | |
if (is_array($value)) { | |
$content = ''; | |
if (!empty($value)) { | |
foreach ($value as $k => $v) { | |
$sub_title = '<strong>' . $k . '</strong>'; | |
$content.= "<span style=''padding-left: 20px'>\n"; | |
$content.= $sub_title . ' : '; | |
$content.= $v; | |
$content.= "</span>\n"; | |
} | |
} | |
} else { | |
$content = $value; | |
} | |
$out.= $title . ': ' . $content . "\n"; | |
} | |
echo $out; | |
curl_close($ch); | |
?></pre> | |
<h2>cURL Response Headers</h2> | |
<pre> | |
<?php | |
$ch = curl_init(); | |
curl_setopt_array( $ch, array( | |
CURLOPT_URL => 'https://m9gnuc7j4d.execute-api.us-east-1.amazonaws.com/hummingbird/', | |
CURLOPT_HEADER => true, | |
CURLOPT_NOBODY => true, | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_HTTP_VERSION => 3, | |
) ); | |
$response = curl_exec( $ch ); | |
echo $response; | |
curl_close($ch); | |
?></pre> | |
<h2>PHPInfo</h2> | |
<pre><?php phpinfo(); ?></pre> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment