1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://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\Http;
13:
14: use Nette;
15:
16:
17: /**
18: * IHttpRequest provides access scheme for request sent via HTTP.
19: *
20: * @author David Grudl
21: */
22: interface IRequest
23: {
24: /** HTTP request method */
25: const
26: GET = 'GET',
27: POST = 'POST',
28: HEAD = 'HEAD',
29: PUT = 'PUT',
30: DELETE = 'DELETE';
31:
32: /**
33: * Returns URL object.
34: * @return UrlScript
35: */
36: function getUrl();
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 uploaded file.
60: * @param string key (or more keys)
61: * @return FileUpload
62: */
63: function getFile($key);
64:
65: /**
66: * Returns uploaded files.
67: * @return array
68: */
69: function getFiles();
70:
71: /**
72: * Returns variable provided to the script via HTTP cookies.
73: * @param string key
74: * @param mixed default value
75: * @return mixed
76: */
77: function getCookie($key, $default = NULL);
78:
79: /**
80: * Returns variables provided to the script via HTTP cookies.
81: * @return array
82: */
83: function getCookies();
84:
85: /********************* method & headers ****************d*g**/
86:
87: /**
88: * Returns HTTP request method (GET, POST, HEAD, PUT, ...). The method is case-sensitive.
89: * @return string
90: */
91: function getMethod();
92:
93: /**
94: * Checks HTTP request method.
95: * @param string
96: * @return bool
97: */
98: function isMethod($method);
99:
100: /**
101: * Return the value of the HTTP header. Pass the header name as the
102: * plain, HTTP-specified header name (e.g. 'Accept-Encoding').
103: * @param string
104: * @param mixed
105: * @return mixed
106: */
107: function getHeader($header, $default = NULL);
108:
109: /**
110: * Returns all HTTP headers.
111: * @return array
112: */
113: function getHeaders();
114:
115: /**
116: * Is the request is sent via secure channel (https).
117: * @return bool
118: */
119: function isSecured();
120:
121: /**
122: * Is AJAX request?
123: * @return bool
124: */
125: function isAjax();
126:
127: /**
128: * Returns the IP address of the remote client.
129: * @return string
130: */
131: function getRemoteAddress();
132:
133: /**
134: * Returns the host of the remote client.
135: * @return string
136: */
137: function getRemoteHost();
138:
139: }
140: