You are here: Re: $_SERVER not working « PHP Programming Language « IT news, forums, messages
Re: $_SERVER not working

Posted by Puneet on 12/05/13 11:50

Thanx Bent... That helped..
I rewrote the code as :-
print "Host port is :". $_SERVER ['SERVER_PORT'] ;

and it worked...

There has to be a space between SERVER and [.. otherwise PHP throws an
exception.



Bent Stigsen wrote:
> Puneet wrote:
>
> > Nope.. If i use your code.. then I am getting this..
> >
> > PHP Notice: Undefined index: HTTP_HOST in C:\Program Files\Apache
> > Group\Apache2\htdocs\_debug_tmp.php on line 5
>
> Then it is (probably) not present in the http-request. Blame your
> browser/proxy.
>
> Perhaps you can use 'SERVER_NAME' instead.
>
>
> > If i use
> > Print "Host is : $_SERVER ['HTTP_HOST']";
>
> Wouldn't work. When using an array inside an string, you will need the curly
> brackets to tell PHP to use the index.
>
> > The I am getting..
> > Host is : Array ['HTTP_HOST']
>
> Since the index is not used, it just tells you that $_SERVER is an array.
>
>
> [snip]
>
>
> --
> /Bent
>
> PS: please don't top post

 

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

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