Posted by Puneet on 11/21/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]
|