-2

in localhost address contain

$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

i tried this code

header("location: step2.php?server=".base64_encode($_SERVER['HTTP_HOST']));

but i want to show only host name i.e means

$server=$_SERVER['HTTP_HOST'];

When i run $_SERVER['HTTP_HOST']; i get result "www.apple.com" only, no "http://" no "/downloads/dashboard/email_messaging/todo.html"

i want this result only in address bar
www.apple.com

Jodocus
  • 7,493
  • 1
  • 29
  • 45
Pk Prajapati
  • 11
  • 1
  • 6

1 Answers1

0

Hello you can try with this global variable $_SERVER['SERVER_NAME']

  • This is a very low quality answer that does not attempt to explain why this is a correct method, nor what exactly it does. (In my opinion, this question is unclear and should not be answered at all.) All answers should endeavor to educate not just the OP, but all future readers. Please improve or remove this answer. Please treat SO like a classroom -- teach. – mickmackusa Dec 09 '17 at 22:59