Source for file IHttpRequest.php

Documentation is available at IHttpRequest.php

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework
  5. 5:  *
  6. 6:  * @copyright  Copyright (c) 2004, 2010 David Grudl
  7. 7:  * @license    http://nettephp.com/license  Nette license
  8. 8:  * @link       http://nettephp.com
  9. 9:  * @category   Nette
  10. 10:  * @package    Nette\Web
  11. 11:  */
  12. 12:  
  13. 13:  
  14. 14:  
  15. 15: /**
  16. 16:  * IHttpRequest provides access scheme for request sent via HTTP.
  17. 17:  *
  18. 18:  * @copyright  Copyright (c) 2004, 2010 David Grudl
  19. 19:  * @package    Nette\Web
  20. 20:  */
  21. 21: interface IHttpRequest
  22. 22: {
  23. 23:     /**#@+ HTTP request method */
  24. 24:     const
  25. 25:         GET 'GET',
  26. 26:         POST 'POST',
  27. 27:         HEAD 'HEAD',
  28. 28:         PUT 'PUT',
  29. 29:         DELETE 'DELETE';
  30. 30:     /**#@-*/
  31. 31:  
  32. 32:     /**
  33. 33:      * Returns URL object.
  34. 34:      * @return UriScript 
  35. 35:      */
  36. 36:     function getUri();
  37. 37:  
  38. 38:     /********************* query, post, files & cookies ****************d*g**/
  39. 39:  
  40. 40:     /**
  41. 41:      * Returns variable provided to the script via URL query ($_GET).
  42. 42:      * If no key is passed, returns the entire array.
  43. 43:      * @param  string key
  44. 44:      * @param  mixed  default value
  45. 45:      * @return mixed 
  46. 46:      */
  47. 47:     function getQuery($key NULL$default NULL);
  48. 48:  
  49. 49:     /**
  50. 50:      * Returns variable provided to the script via POST method ($_POST).
  51. 51:      * If no key is passed, returns the entire array.
  52. 52:      * @param  string key
  53. 53:      * @param  mixed  default value
  54. 54:      * @return mixed 
  55. 55:      */
  56. 56:     function getPost($key NULL$default NULL);
  57. 57:  
  58. 58:     /**
  59. 59:      * Returns HTTP POST data in raw format (only for "application/x-www-form-urlencoded").
  60. 60:      * @return string 
  61. 61:      */
  62. 62:     function getPostRaw();
  63. 63:  
  64. 64:     /**
  65. 65:      * Returns uploaded file.
  66. 66:      * @param  string key (or more keys)
  67. 67:      * @return HttpUploadedFile 
  68. 68:      */
  69. 69:     function getFile($key);
  70. 70:  
  71. 71:     /**
  72. 72:      * Returns uploaded files.
  73. 73:      * @return array 
  74. 74:      */
  75. 75:     function getFiles();
  76. 76:  
  77. 77:     /**
  78. 78:      * Returns variable provided to the script via HTTP cookies.
  79. 79:      * @param  string key
  80. 80:      * @param  mixed  default value
  81. 81:      * @return mixed 
  82. 82:      */
  83. 83:     function getCookie($key$default NULL);
  84. 84:  
  85. 85:     /**
  86. 86:      * Returns variables provided to the script via HTTP cookies.
  87. 87:      * @return array 
  88. 88:      */
  89. 89:     function getCookies();
  90. 90:  
  91. 91:     /********************* method & headers ****************d*g**/
  92. 92:  
  93. 93:     /**
  94. 94:      * Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.
  95. 95:      * @return string 
  96. 96:      */
  97. 97:     function getMethod();
  98. 98:  
  99. 99:     /**
  100. 100:      * Checks HTTP request method.
  101. 101:      * @param  string 
  102. 102:      * @return bool 
  103. 103:      */
  104. 104:     function isMethod($method);
  105. 105:  
  106. 106:     /**
  107. 107:      * Return the value of the HTTP header. Pass the header name as the
  108. 108:      * plain, HTTP-specified header name (e.g. 'Accept-Encoding').
  109. 109:      * @param  string 
  110. 110:      * @param  mixed 
  111. 111:      * @return mixed 
  112. 112:      */
  113. 113:     function getHeader($header$default NULL);
  114. 114:  
  115. 115:     /**
  116. 116:      * Returns all HTTP headers.
  117. 117:      * @return array 
  118. 118:      */
  119. 119:     function getHeaders();
  120. 120:  
  121. 121:     /**
  122. 122:      * Is the request is sent via secure channel (https).
  123. 123:      * @return bool 
  124. 124:      */
  125. 125:     function isSecured();
  126. 126:  
  127. 127:     /**
  128. 128:      * Is AJAX request?
  129. 129:      * @return bool 
  130. 130:      */
  131. 131:     function isAjax();
  132. 132:  
  133. 133:     /**
  134. 134:      * Returns the IP address of the remote client.
  135. 135:      * @return string 
  136. 136:      */
  137. 137:     function getRemoteAddress();
  138. 138:  
  139. 139:     /**
  140. 140:      * Returns the host of the remote client.
  141. 141:      * @return string 
  142. 142:      */
  143. 143:     function getRemoteHost();
  144. 144: