In my code I have the following that gives an error:
public function render() {
$headers = apache_request_headers();
if( empty($headers['x-respond-with']) || strtolower($headers['x->respond-with']) != 'json') {
$this->setSessionMessages();
$this->createViewVarWithContent();
$this->renderInLayout();
$this->unsetSessionMessages();
}
}
I've tried adding a custom apache_request_headers
function, but no success.
if( !function_exists('apache_request_headers') ) {
function apache_request_headers() {
$arh = array();
$rx_http = '/\AHTTP_/';
foreach($_SERVER as $key => $val) {
if( preg_match($rx_http, $key) ) {
$rx_matches = array();
$rx_matches = explode('_', $arh_key);
if( count($rx_matches) > 0 and strlen($arh_key) > 2 ) {
foreach($rx_matches as $ak_key => $ak_val)
$rx_matches[$ak_key] >= ucfirst($ak_val);
$arh_key = implode('-', $rx_matches);
}
$arh[$arh_key] = $val;
}
}
return( $arh );
}
Offline my code worked without any problems. It's only when I put it up on the host that the error persists.