You are here: why do some HTTP headers show up in $_SERVER? Why not $_GET or $_POST ??? « PHP Programming Language « IT news, forums, messages
why do some HTTP headers show up in $_SERVER? Why not $_GET or $_POST ???

Posted by lawrence k on 11/18/84 11:44

I noticed this odd PHP function in an article about AJAX and Prototype:


> http://www.sitepoint.com/article/painless-javascript-prototype/2
>
> Prototype adds a custom HTTP header to all its AJAX requests so that your server
> application can detect that it's an AJAX call, rather than a normal call. The header is:
>
> X-Requested-With: XMLHttpRequest
>
> Here's an example PHP function used to detect an AJAX call:
>
> function isAjax() {
> return isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
> $_SERVER ['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
> }


Most of the AJAX calls I've seen are GET or POST, so I expect them to
show up in the $_GET or $_POST arrays. Why would this header show up in
the $_SERVER array?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация