Jump to content

[SOLVED] top domain from string


Guest

Recommended Posts

oops, sorry, misread what u needed.

 

<?php

$url = "http://www.whatever.com/site/what.php";
$domain = substr($url, strpos($url, "//")+2, strlen($url));
$domain = substr($domain, 0, strpos($domain, "/"));
$domain = "http://".$domain;
echo $domain;

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.