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