php Hummingbird API快速诊断

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Hummingbird API快速诊断相关的知识,希望对你有一定的参考价值。

<?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>

以上是关于php Hummingbird API快速诊断的主要内容,如果未能解决你的问题,请参考以下文章

Gibson Hummingbird Koa 特别限量版

PHP PayPal API 快速结帐

Google API php 快速入门 listFiles() 500 内部错误

一文带你快速了解 Java 线上问题快速诊断神器 Arthas

一文带你快速了解 Java 线上问题快速诊断神器 Arthas

数据库AIOps案例:快速诊断数据库性能问题