Substract from a string

Posted on 2006-11-17
Last Modified: 2008-02-01
I using $_SERVER['HTTP_REFERER'] to get the referals to my site.

And I get them as

I would like to store them as

But I need help to how substract this.
Question by:brightwood
LVL 13

Accepted Solution

rhickmott earned 500 total points
ID: 17966998

$url      =         parse_url($_SERVER['HTTP_REFERER']);
$url      =         $url['scheme'] . "://" . $url[host];
LVL 15

Expert Comment

ID: 17967008
try using the parse url function
LVL 29

Expert Comment

ID: 17967075
If it's a whole list or URL's you have to parse, you can use this:


$s = '';

preg_match_all('/.*?\/\/[^\/]+/', $s, $matches);



Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now