Unstoppable Domains

Parsing urls in a script

Spaceship Spaceship
Watch

liam_d

The original NP Emo KidEstablished Member
Impact
25
Hi all i have this;

PHP:
	//urls	
	$chr_limit = '45';
	$add = '...';
	
	$view = preg_replace("!(http:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*)!e", "'<a href=\"\\1\" title=\"\\1\" target=\"_blank\">'.(strlen('\\1')>=$chr_limit ? substr('\\1',0,$chr_limit).'$add':'\\1').'</a>'", $view);

Although that doesn't parse urls if there is no http://, can anyone modify that or create one like it to handle urls with the http:// ?

Thanks!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
0
•••
Thats not what i mean, parsing url for bbcode it what im doing...if you know php you would read my code above and understand :P
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back