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 as string

    How does one get the entire URL, I'm particularly interested
    in getting the http and/or https.... am I going about this wrong... I need to find a way to detect if the current page
    is in use is using SSL or not

    Thank you in advance

  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)
    The parse_url function may be of use to you. I only stumbled upon it the other day by accident.

    http://php.net/manual/en/function.parse-url.php

  3. #3
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice one, Sid -- definitely useful. If for whatever reason you don't want to use it, you can try something like this:

    PHP Code:
    <?php
      $url 
    "http://www.yahoo.com";
      if (
    strpos($url"s") == 4) {
        print 
    "Secure";
      } else {
        print 
    "Not Secure";
      }
    ?>
    Add the "s" after "http" and the output should change. Best of luck!


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
  •