Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsWeb Design & DevelopmentServer Side ScriptingPHP right
  Closed Topic Start new topic
left right
Jetteh22
post Jul 17 2008, 07:28 PM
Post #1


PHP Programmer
*******

Group: Members
Posts: 895
Joined: 9-March 08
From: Naples, FL
Member No.: 13,296



I've tried everything I can possibly think of. I've googled for over an hour tested many things and yet nothign works the way I want it to...

I need a PHP script that would do the following:

Strip A URL to JUST the domain and extension:

Examples:
"http://zymic.com/forum/" turns into "zymic.com"
"http://subdomain.coolsite.com" turns into "coolsite.com"
"http://yourmom.com/index.php?if=this&this=that" turns into "yourmom.com"

It then needs to check if the site is an exisiting site.
I've tried using the fsockopen thing and I couldn't get it to work right, dunno what I did..

If it's valid it needs to just return TRUE... If it's not just needs to return FALSE...

Ie...

User Inputs $url

$url = "http://this.site.com/?referrer=thisandthat"

I need it to take URL and strip it so that it ends up like this

$url = "http://this.site.com/?referrer=thisandthat"
$stripped = "site.com"

and then it needs to check if "site.com" is valid or not..

if($stripped = valid)
{
TRUE
}
else
{
FALSE
}

Basically.. Obviously that's fake code but trying to get a point across.

So basically

User inputs http://www.zymic.com/?if=asdf
it will change it to zymic.com
it will check to see if zymic.com is valid
and return TRUE

User inputs http://asdf83381adfa.com
It will change it to asdf83381adfa.com
It will check and see if it is valid
and return FALSE (because it's not.)

Any help would be appreciated

NOTE: This is not a site hosted on zymic. I believe I have full access to all possible php functions (including fsockopen ect) so that's not a worry.

Go to the top of the page 
 
  + Quote Post
Popcorn
post Jul 18 2008, 09:53 AM
Post #2


Member
**

Group: Members
Posts: 66
Joined: 19-November 07
Member No.: 3,062



$url = parse_url($url);
echo $url['host'];
Go to the top of the page 
 
  + Quote Post
Jetteh22
post Jul 18 2008, 05:45 PM
Post #3


PHP Programmer
*******

Group: Members
Posts: 895
Joined: 9-March 08
From: Naples, FL
Member No.: 13,296



Thanks popcorn.

Dunno why I didn't find that... Everything I found was like 12 lines long and it didn't even work for me.

And I found a valid way to check if a site is up or not, so thanks biggrin.gif
Go to the top of the page 
 
  + Quote Post
 Closed Topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 19th May 2013 - 01:00 AM