Remove text on a link

waffy

New member
Hello guys, i need some help from all of you. Just what the title say how can i remove this text
Code:
http://ftp.
on this link
Code:
http://ftp.domain.com
I tried using str replace
Code:
$url = str_replace('http://ftp.' , '' , $url); but no luck, any expert suggestions? Thank you.
 

admin

Administrator
Staff member
I'd have to see the code, There's not enough to go off with what you posted.

Sent from my ME173X using Tapatalk
 

jaran

New member
Try this to get two letter of domain

PHP:
<?php
$tsring = 'http://ftp.domain.com/bla-bla-bla';
$match = preg_match('@^(?:http://)?([^/]+)@i',$string,$m);
$domain = $m[1];
?>

or you can use parse_url function.