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