Advertisement
wehandler

Curl header checker

Oct 5th, 2017
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.94 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">
  2.   <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  3.     <head>
  4.       <title>PHP HEADER CHECKER</title>
  5.       <meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" />
  6.      <meta name="viewport" content="width=device-width,initial-scale=1">
  7. <b><font color="lime">Enter host or ip whose headers you want to view</font></b>
  8.  
  9.   </head>
  10. <style>body {
  11. background-color: black;
  12. color: #303030;
  13. } input, button {
  14. color : #00ff00;
  15. background-color : black;
  16. border : 1px solid #303030;
  17. } form {
  18. margin: 0;
  19. padding: 0;
  20. } </style>
  21. <form method="post">
  22. <input name="put" type="text" value="">
  23. <br/><br/>
  24. <input type="submit"name="get"value="Submit"/></form>
  25. <?php
  26.  
  27.  
  28.  
  29.     function parseHeaders($data)
  30.     {
  31.         $headers = explode("\r\n", $data);
  32.         foreach($headers as $i => $header)
  33.         {
  34.             $value = explode(' ', $header);
  35.             $key = $value[0];
  36.             array_shift($value);
  37.             $return[strtolower(trim($key, ':'))] = implode(' ', $value);
  38.         }
  39.         return $return;
  40.     }
  41.  
  42.    function makeHeaders($headers)
  43.     {
  44.        
  45.         foreach($headers as $key => $value)
  46.         {
  47. $kalimat = strtoupper($key);
  48.             $string .= "<b>$kalimat</b> => $value" . "<br/>";
  49.         }
  50.         $string .= "<br/>";
  51.         return $string;
  52.     }
  53. ?>
  54. <?
  55. function http_head_curl($url,$timeout=10)
  56. {
  57.     $ch = curl_init();
  58.     curl_setopt($ch, CURLOPT_URL, $url);
  59. curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0");
  60.     curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
  61.     curl_setopt($ch, CURLOPT_HEADER, 1);
  62.     curl_setopt($ch, CURLOPT_NOBODY, 1);
  63.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  64.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  65.     $res = curl_exec($ch);
  66.     if ($res === false) {
  67.       echo "Your input is not valid";
  68.     }
  69.     return trim($res);
  70. }
  71. ?>
  72. <?
  73. if($_POST['get']){
  74. $pt=$_POST['put'];
  75. if(empty($pt)){
  76. echo '<font color="white"><br/>You entered is :</font> <font color="red">Empty</font>';
  77. }else{
  78. $qfs = str_replace("http://","",$pt);
  79. $ur = str_replace("https://","",$qfs);
  80. $fok = http_head_curl('http://'.$ur.'',5);
  81. $parts = explode("\r\n",$fok);
  82. $party = implode("<br/>",$parts);
  83. $tpl = parseHeaders($fok);
  84. $done = makeHeaders($tpl);
  85. if(preg_match("/CONTENT-TYPE/",$done)){
  86. echo '<font color="white"><br/>You entered is :</font><font color="lime">'.$ur.'</font><font color="white"><br/>'.$done.'</font>';
  87. }else{
  88. $uri = str_replace("=>",'<font color="white"><br/>You entered is :</font> <font color="red">'.$ur.'</font><font color="red"><br/>You entered is not valid or fraud</font>',$done);
  89. echo $uri;
  90. }
  91. }
  92. }
  93. ?>
  94.  
  95. <center><font color="white">Powered by wehandler<br/>
  96. <?php echo ''.$_SERVER['HTTP_HOST'].' - &copy; '.$now.''; ?></font><br/>
  97. </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement