Search

A new Extension, “Server Headers” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

A Data Source that adds various server headers into the XML.

Cool, thanks.

One thing, I'm getting this Symphony XSLT Processing Error:

  loadXML(): EntityRef: expecting ';' in Entity,

pointing to the server-headers/http-referer element. It only happens when I'm coming from another page, not on page reload. Is this me or the extension?

Seems that in data.server_headers.php the closing ?> is missing.

I added one more line (to get the IP of clients using a proxy server):

$result->appendChild(new XMLElement("http-x-forwarded-for", $_SERVER['HTTP_X_FORWARDED_FOR']));

I'm getting this Symphony XSLT Processing Error:

That will be because the value is not being encoded. Each element's value needs to be wrapped in General::sanitize(...). I'll fix that up asap.

Seems that in data.server_headers.php the closing ?> is missing.

No need to have a closing ?> tag in PHP files unless you are embedding PHP statements. E.G. in a HTML string. The problem with using ?> on a PHP script is that if you accidently leave a newline or space character after it, then you end up with "Headers already sent" errors as technically that space (or newline) is output.

Yay! Thanks.

I've updated the code to include the HTTP_X_FORWARDED_FOR header if it exists, and also encode all values. Should prevent any invalid XML.

Thank you, Alistair. Works perfectly for me!

this puts no params in 2.0.2 ?....

Still works perfectly in 2.0.2!

what headers does it include then?
if browserlanguage is included, i should reinstal it again to see why it didnt work for me.

By default it includes:

'HTTP_REFERER',
'HTTP_USER_AGENT',
'HTTP_HOST',
'SERVER_NAME',
'SERVER_ADDR',
'SERVER_PORT',
'REMOTE_ADDR',
'QUERY_STRING',
'HTTP_X_FORWARDED_FOR'

You'll find all of these in your XML. It's easy to add more if you like: Just edit the datasource file data.server_headers.php.

thanks, for people who prefer not to edit php, or already use the global parameter extension (because I assume it can do all that this extension does) they migth want to try to add a rule to thatone, as I propose over there

@Alistair thank you!

I added to it for my purposes, maybe you want to update the extension?

foreach($_SERVER as $key => $header){
            if(strlen(trim($_SERVER[$key])) == 0) continue;
            $result->appendChild(new XMLElement(strtolower(str_replace('_', '-', $key)), General::sanitize($_SERVER[$key])));
        }

Download extension

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details