newb Posted October 8, 2006 Share Posted October 8, 2006 how do i convert google.com or if the user inputs www.google.com to http:// or if they already have http:// it wont add the extra http:// like in vbulletin?? does anyone know how i been trying to figure it out i dont kno how to do it someone pleeze give me example pls help thanks im new at php idk where 2 start. Link to comment https://forums.phpfreaks.com/topic/23378-convert-urls-to-http/ Share on other sites More sharing options...
trq Posted October 8, 2006 Share Posted October 8, 2006 [code=php:0]if (!strstr($url,'http://')) { $url = 'http://'.$url;}[/code] Link to comment https://forums.phpfreaks.com/topic/23378-convert-urls-to-http/#findComment-105994 Share on other sites More sharing options...
newb Posted October 8, 2006 Author Share Posted October 8, 2006 thx. i revised it a bit so it checks if the user inputs just www.google.com or google.com[code]<?phpif (!strstr($url,'http://')) { if (strstr($url,'www')) { $url = 'http://'.$url; } else { $url = 'http://www.'.$url; }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/23378-convert-urls-to-http/#findComment-106005 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.