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