Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts

    breaking apart HTTP_REFERER

    I need three parts of information from the HTTP_REFERER.

    1) Any sudomains, not including the http:// or a trailing period. This could be mail or even users.johnsmith

    2) The domain, not including any folders, files, or trailing / For instance google.com

    3) The page, not including any folders, get data, or anchors. For instance contactus.php

    This is best done with regex i'm sure, but I am quite horrible at it. Assistance would be lovely. Thank you.
    Last edited by Ultragames; 08-02-2007 at 03:33 AM. Reason: Added #3
    If I'm postin here, I NEED YOUR HELP!!

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,095
    Thanks
    11
    Thanked 101 Times in 99 Posts
    parse_url() is your friend.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New to the CF scene
    Join Date
    Aug 2007
    Location
    Kolkata,India
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    aha! I knew there was something like that that I had used before. Thank you very much!
    If I'm postin here, I NEED YOUR HELP!!

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    parse_url() does not seperate the subdomain from the domain. Can someone help with that?
    If I'm postin here, I NEED YOUR HELP!!

  • #6
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,095
    Thanks
    11
    Thanked 101 Times in 99 Posts
    PHP Code:
    <?php
    $url
    =parse_url('http://deb.centurioncomputers.com.au/testa.php');
    $bits=explode('.'$url['host']);

    $subdomain $bits[0];
    echo 
    $subdomain;
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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