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