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