timmah1 Posted May 29, 2008 Share Posted May 29, 2008 I need to write a script that will strip the page away from the URL, meaning, if the website is http://www.test.com/~test/1.html, I want a page that will show just the domain name, http://www.test.com. I need to have a page that will list domain names that I enter, and then list them with just the URL and possibly by Page Rank. Is this possible? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/107799-need-help-with-domain-names/ Share on other sites More sharing options...
MadTechie Posted May 29, 2008 Share Posted May 29, 2008 you want to get a list or urls and only show the domain and sort by page rank.. yep thats possible Link to comment https://forums.phpfreaks.com/topic/107799-need-help-with-domain-names/#findComment-552617 Share on other sites More sharing options...
timmah1 Posted May 29, 2008 Author Share Posted May 29, 2008 WOW! Thanks, that was exactly what I was looking for. Now, how would I get this to display the http:// with the domain name. From what I've found, you need to have the http:// in the domain name to check the Page Rank Here is the script $hostname = $_SERVER['SERVER_NAME']; $hostname = str_replace('www.', '', $hostname); echo $hostname; Thanks in advance Link to comment https://forums.phpfreaks.com/topic/107799-need-help-with-domain-names/#findComment-552646 Share on other sites More sharing options...
MadTechie Posted May 29, 2008 Share Posted May 29, 2008 the code you have removed the www., i am not 100% sure what your asking.. do you have an example of what you have and what you want it to appear like? Link to comment https://forums.phpfreaks.com/topic/107799-need-help-with-domain-names/#findComment-552653 Share on other sites More sharing options...
timmah1 Posted May 29, 2008 Author Share Posted May 29, 2008 I am trying to get just the domain name from a list of domains. These domain names: http://www.test.com/~test/binary/1.html http://www.foo.com/~test/1.html http://www.ohyeah.com/letsgo/havesome/t.html To show this: http://www.test.com http://www.foo.com http://www.ohyeah.com Then, check those domain names Page Rank, then list them from highest to lowest. Now, if I use this: include('pagerank.php'); $names = array("domain0","domain1","domain2"); $pr = getPageRank('$name[0]','$name[1]','$name[2]'); echo ' PR '.$pr; It obviously don't work. I need the array to be just the domains, then checked against Google's Page Rank Does that make sense? Link to comment https://forums.phpfreaks.com/topic/107799-need-help-with-domain-names/#findComment-552680 Share on other sites More sharing options...
DarkWater Posted May 29, 2008 Share Posted May 29, 2008 $parts = parse_url("http://www.google.com/lol"); echo "{$parts['scheme']}{$parts['hostname']}"; Link to comment https://forums.phpfreaks.com/topic/107799-need-help-with-domain-names/#findComment-552689 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.