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? Quote 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 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/263215-getting-domain-from-url/#findComment-1348978 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.