[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Substract from a string

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

And I get them as
http://www.dunemaul.org/forums/viewtopic.php?t=8118
http://www.fallenheroes-guild.com/index.php
http://www.gwi.dk/Forum/viewtopic.php?t=395

I would like to store them as
http://www.dunemaul.org
http://www.fallenheroes-guild.com
http://www.gwi.dk

But I need help to how substract this.
0
Comment
Question by:brightwood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

by:
rhickmott earned 2000 total points
ID: 17966998
http://uk.php.net/function.parse-url

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

Expert Comment

by:babuno5
ID: 17967008
try using the parse url function
http://in.php.net/manual/en/function.parse-url.php
0
 
LVL 29

Expert Comment

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

<?php

$s = 'http://www.dunemaul.org/forums/viewtopic.php?t=8118
http://www.fallenheroes-guild.com/index.php
http://www.gwi.dk/Forum/viewtopic.php?t=395';

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

print_r($matches);

?>
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

649 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