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