132
135
return pack("H*", $data);
139
if (!function_exists('http_response_code')) {
141
* http_response_code does not exists in PHP < 5.4
142
* http://php.net/manual/en/function.http-response-code.php
144
function http_response_code($code = NULL) {
145
if ($code !== NULL) {
147
case 100: $text = 'Continue'; break;
148
case 101: $text = 'Switching Protocols'; break;
149
case 200: $text = 'OK'; break;
150
case 201: $text = 'Created'; break;
151
case 202: $text = 'Accepted'; break;
152
case 203: $text = 'Non-Authoritative Information'; break;
153
case 204: $text = 'No Content'; break;
154
case 205: $text = 'Reset Content'; break;
155
case 206: $text = 'Partial Content'; break;
156
case 300: $text = 'Multiple Choices'; break;
157
case 301: $text = 'Moved Permanently'; break;
158
case 302: $text = 'Moved Temporarily'; break;
159
case 303: $text = 'See Other'; break;
160
case 304: $text = 'Not Modified'; break;
161
case 305: $text = 'Use Proxy'; break;
162
case 400: $text = 'Bad Request'; break;
163
case 401: $text = 'Unauthorized'; break;
164
case 402: $text = 'Payment Required'; break;
165
case 403: $text = 'Forbidden'; break;
166
case 404: $text = 'Not Found'; break;
167
case 405: $text = 'Method Not Allowed'; break;
168
case 406: $text = 'Not Acceptable'; break;
169
case 407: $text = 'Proxy Authentication Required'; break;
170
case 408: $text = 'Request Time-out'; break;
171
case 409: $text = 'Conflict'; break;
172
case 410: $text = 'Gone'; break;
173
case 411: $text = 'Length Required'; break;
174
case 412: $text = 'Precondition Failed'; break;
175
case 413: $text = 'Request Entity Too Large'; break;
176
case 414: $text = 'Request-URI Too Large'; break;
177
case 415: $text = 'Unsupported Media Type'; break;
178
case 500: $text = 'Internal Server Error'; break;
179
case 501: $text = 'Not Implemented'; break;
180
case 502: $text = 'Bad Gateway'; break;
181
case 503: $text = 'Service Unavailable'; break;
182
case 504: $text = 'Gateway Time-out'; break;
183
case 505: $text = 'HTTP Version not supported'; break;
185
exit('Unknown http status code "' . htmlentities($code) . '"');
189
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
190
header($protocol . ' ' . $code . ' ' . $text);
192
$GLOBALS['http_response_code'] = $code;
194
$code = (isset($GLOBALS['http_response_code']) ? $GLOBALS['http_response_code'] : 200);
201
if (!function_exists('memory_get_peak_usage')) {
203
* memory_get_peak_usage is not available prior to PHP 5.2.
204
* This complementary function will return the value of memory_get_usage();
205
* @see http://php.net/manual/en/function.memory-get-usage.php
206
* @see http://php.net/manual/en/function.memory-get-peak-usage.php
208
* @param boolean $real_usage
210
function memory_get_peak_usage($real_usage = false) {
211
ZLog::Write(LOGLEVEL_DEBUG, "memory_get_peak_usage() is not available on this system. The value of memory_get_usage() will be used.");
212
return memory_get_usage();
b'\\ No newline at end of file'