SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Grab URL from Browser's Location Bar

    Hi

    No this is not a repost.

    Thx to 2 who responed to my last posting,
    yes 'parse_url' and this code snippet

    <?php
    $url = "http://www.yahoo.com";
    if (strpos($url, "s") == 4) {
    print "Secure";
    } else {
    print "Not Secure";
    }
    ?>

    are very useful, but both require you to know
    the $url first, I want to obtain the full url
    from currently shown in the browser then use
    one of the 2 methods shown above.

    Thank you in adavance

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK - I think I see what the problem is. Going back to your previous thread, you are trying to find out if the request was made for a secure socket connection - right? You want to see if the request contains "http://" or "https://" but neither $HTTP_HOST or $REQUEST_URI are going to tell you the protocol. Maybe what you want to do is look at the port the client has made the request on using $REMOTE_PORT. I don't know if this will work because I can't test it - I don't have access to an Apache server running with SSL right this minute. But a http request should come in on port 80 and a https request should come in on port 9080 (be default - is that right?!?).

    No, no, no - this is even better $SERVER_PORT.

    I'm reading http://php.net/manual/en/language.va...predefined.php

  3. #3
    SitePoint Member
    Join Date
    Feb 2001
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Found the answer

    ... sorry I miss this on in the environment variables

    just check the current port... see SERVER_PORT

    like most people... regular pages on port 80
    and SSL on port 443....


    I just thought I post this for anyone else who was
    interested

    Thx anywayz guyz


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •