I am trying to set a variable based on HTTP_REFERER... but for example, if the page I was at right now when posting this topic detected my referer, it'd show as http://forums.digitalpoint.com/newthread.php?do=newthread&f=37 Code (markup): Is there a way I can manipulate the string to cut off at http://forums.digitalpoint.com Code (markup): to use as easy as it is to use simply... $site = $_SERVER['HTTP_REFERER']; Code (markup): I don't know if this is a matter of using 'strpos' or what.
Hi, What you may do is – Find the first occurrence of “/†starting from the 8th position of the string in HTTP_Referrer Then get a sub string starting from beginning of the string till the position retuned above, this will give you what you want. Hope this makes sense to you. Cheers, ~Maneet
might want to try parse_url : also $info['scheme'] will give you the "http" bit ... you would need to add the "://" ... or you could just add "http://" ...