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