Welcome Guest, Not a member yet? Register   Sign In
Getting domain from string
#1

[eluser]Jujubins[/eluser]
Theres some function in CI to do that?

Example:
http://images.google.com/search?tbm=isch...=&aql;=&oq;=

Return:
google.com
#2

[eluser]Iván Argulo[/eluser]
This will return "images.google.com"

Code:
$url = 'http://images.google.com/q?all_params&and=so&on;';

// Deletes the ugly protocol
$url = str_replace('http://', '', $url);
$url = str_replace('https://', '', $url);
            
$url_a = explode('/', $url);
            
$url_show = $url_a[0];

echo $url_show;

Of course it could be improved, but it's a 1-minute solution.

Hope it helps
#3

[eluser]n0xie[/eluser]
There is parse_url()




Theme © iAndrew 2016 - Forum software by © MyBB