PHP检测网站炸没炸 [index.html] <!DOCTYPE HTML> <html> - Assbbs

PHP检测网站炸没炸 index.html &lt;!DOCTYPE&nbsp;HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta&nbsp;charset=&quot;utf-8&quot;&nbsp;/&gt; &lt;meta&nbsp;name=&quot;viewport&quot;&nbsp;content=&…

PHP检测网站炸没炸 index.html &lt;!DOCTYPE&nbsp;HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta&nbsp;charset=&quot;utf-8&quot;&nbsp;/&gt; &lt;meta&nbsp;name=&quot;viewport&quot;&nbsp;content=&quot;width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no&quot;&nbsp;/&gt; &lt;meta&nbsp;name=&quot;keywords&quot;&nbsp;content=&quot;网站炸了没,炸了没,Crash&quot;&nbsp;/&gt; &lt;meta&nbsp;name=&quot;description&quot;&nbsp;content=&quot;网站炸了没,炸了没,Crash&quot;&nbsp;/&gt; &lt;link&nbsp;rel=&quot;icon&quot;&nbsp;href=&quot;data:,&quot;&nbsp;/&gt; &lt;title&gt;网站炸了没?&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;b&gt;网站炸了没?&lt;/b&gt;&lt;br&nbsp;/&gt; &lt;input&nbsp;id=&quot;url&quot;&nbsp;/&gt; &lt;input&nbsp;type=&quot;button&quot;&nbsp;value=&quot;瞅瞅&quot;&nbsp;onclick=&quot;crash ;&quot;&gt; &lt;div&nbsp;id=&quot;see&quot;&gt;&lt;/div&gt; &lt;script&gt; function&nbsp;crash { var&nbsp;url=document.getElementById & 39;url& 39; ; var&nbsp;see=document.getElementById & 39;see& 39; ; see.innerHTML=& 39;& 39;; if !url.value {return;}; var&nbsp;xhr=new&nbsp;XMLHttpRequest ; xhr.open & 39;GET& 39;,& 39;//proxy.example.com/proxy.php?url=& 39;+encodeURIComponent window.btoa url.value ,true ; xhr.onerror=function {alert & 39;查询服务器废了& 39; ;}; xhr.onreadystatechange=function {if this.readyState===4&nbsp;&amp;&amp;&nbsp;this.status===200 { var&nbsp;json=JSON.parse this.responseText ; if json.status==& 39;success& 39; {see.innerHTML=& 39;美滋滋……&lt;br&nbsp;/&gt;IP:&amp;nbsp;& 39;+json.primary ip+& 39;&lt;br&nbsp;/&gt;Time:&amp;nbsp;& 39;+json.total time+& 39;&lt;br&nbsp;/&gt;& 39;;} else{see.innerHTML=& 39;悲剧了……& 39;;}; }}; xhr.send null ; }; &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; proxy.php //代理主机,公网可以自由访问 &lt;?php function&nbsp;chk $url { $r=array ; $c=curl init $url ; curl setopt $c,CURLOPT TIMEOUT,10 ; curl setopt $c,CURLOPT SSL VERIFYPEER,0 ; curl setopt $c,CURLOPT SSL VERIFYHOST,0 ; curl setopt $c,CURLOPT RETURNTRANSFER,1 ; curl setopt $c,CURLOPT HEADER,0 ; curl setopt $c,CURLOPT NOBODY,0 ; $e=curl exec $c ; if curl errno $c {$e=& 39;{&quot;status&quot;:&quot;error&quot;}& 39;;} curl close $c ; return&nbsp;$e; } header & 39;Access-Control-Allow-Origin:&nbsp; & 39; ; if empty $ GET & 39;url& 39; {echo&nbsp;& 39;{&quot;status&quot;:&quot;error&quot;}& 39;;die;} echo&nbsp;chk & 39;https://touch.example.com/touch.php?url=& 39;.trim $ GET & 39;url& 39; ; ?&gt; touch.php //放到国内主机,并将代理主机添加进白名单 &lt;?php function&nbsp;chk $url { $r=array ; $c=curl init $url ; curl setopt $c,CURLOPT TIMEOUT,5 ; curl setopt $c,CURLOPT SSL VERIFYPEER,0 ; curl setopt $c,CURLOPT SSL VERIFYHOST,0 ; curl setopt $c,CURLOPT RETURNTRANSFER,1 ; curl setopt $c,CURLOPT HEADER,0 ; curl setopt $c,CURLOPT NOBODY,1 ; curl exec $c ; if curl errno $c {$r & 39;status& 39; =& 39;failed& 39;;return&nbsp;$r;} $i=curl getinfo $c ; curl close $c ; $r & 39;status& 39; =& 39;success& 39;; $r & 39;primary ip& 39; =isset $i & 39;primary ip& 39; ?$i & 39;primary ip& 39; :null; $r & 39;total time& 39; =isset $i & 39;total time& …