xwishmasterx Posted May 27, 2012 Share Posted May 27, 2012 I am tring to get the domain from a url inside a while loop. Currently my code looks like this: ...while($row = mysql_fetch_array( $result )){ ?><img src="<?php echo "".$row['te_link']."";?>..... If $row['te_link'] returns "http://domain.com/images/..." I need it to just return http://domain.com". I've tried various functions to strip the unwanted stuff, but nothing working correct. Anyone can help me out? Link to comment https://forums.phpfreaks.com/topic/263215-getting-domain-from-url/ Share on other sites More sharing options...
.josh Posted May 27, 2012 Share Posted May 27, 2012 parse_url Link to comment https://forums.phpfreaks.com/topic/263215-getting-domain-from-url/#findComment-1348975 Share on other sites More sharing options...
xwishmasterx Posted May 27, 2012 Author Share Posted May 27, 2012 I could have sworn I tried it several times with no luck...worked the first time.lol Thanks Link to comment https://forums.phpfreaks.com/topic/263215-getting-domain-from-url/#findComment-1348978 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.