Code Snippets

  

PHP Source Code


Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 95,549 PHP Programmers for FREE!. Ask your question and get quick answers from Dream.In.Code experts. There are 928 online right now! We're the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a PHP Expert

Register to Make This Box Go Away!



Full url of the page

get full url of the page.

Submitted By:
Actions:
Rating:
Views: 23,570

Language: PHP

Last Modified: March 16, 2005
Instructions: i use for error logging, tells me what page.
use $_SERVER so it logged as superglobal.

Snippet


  1. <?
  2. $_SERVER['FULL_URL'] = 'http';
  3. if($_SERVER['HTTPS']=='on'){$_SERVER['FULL_URL'] .=  's';}
  4. $_SERVER['FULL_URL'] .=  '://';
  5. if($_SERVER['SERVER_PORT']!='80') $_SERVER['FULL_URL'] .=  $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME'];
  6. else
  7. $_SERVER['FULL_URL'] .=  $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
  8. if($_SERVER['QUERY_STRING']>' '){$_SERVER['FULL_URL'] .=  '?'.$_SERVER['QUERY_STRING'];}
  9. ?>

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month
-->