Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $str = 'Mời tham gia câu lạc bộ Những người ưa thích nghề quảng cáo
- Các bạn click vào link này để tham gia nhé: http://cafecongso.com/room/discuss/Hoi-quang-cao-69.html';
- define('PROXYURL', 'http://cafecongso.com/proxy?url=');
- function urlParser($str){
- $str = str_replace("\\r","\r",$str);
- $str = str_replace("\\n","\n<BR>",$str);
- $str = str_replace("\\n\\r","\n\r",$str);
- $in=array(
- '`((?:https?|ftp)://\S+[[:alnum:]]/?)`si',
- '`((?<!//)(www\.\S+[[:alnum:]]/?))`si'
- );
- $out=array(
- '<a href="'.PROXYURL.'$1">$1</a> ',
- '<a href="'.PROXYURL.'http://$proxyUrl$1">$1</a>'
- );
- return preg_replace($in,$out,$str);
- }
- echo urlParser($str);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment