TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Check if Website Exists? (http://www.talkphp.com/absolute-beginners/4973-check-if-website-exists.html)

pixelgod 09-27-2009 06:56 AM

Check if Website Exists?
 
Hi guys, this is driving me crazy. I don't care which method I use, I just want it to work. How can I get my script to check if the user submitted article is accessible or not?

I can't figure out how I can get it to work with all of the possible urls
www.website.com
http://www.website.com
https://www.website.com
http://www.website.com/directory/index.php?id=2425
etc.

Any help would be greatly appreciated :)

etoolbox 09-27-2009 06:52 PM

http://www.php.net/file_get_contents
http://www.php.net/curl

pixelgod 09-28-2009 12:06 AM

Thank you, I managed to do it with curl. Turns out I had php errors turned off and php safe mode turned on.

I have another question now, is there any possible way to get the root domain out of a link? so if someone submits
http://www.subdomain.domain.com/aasdg/bob/horse.html

my script can somehow get www.domain.com

etoolbox 09-28-2009 12:13 AM

http://www.php.net/parse_url should do the trick. It's a useful function but I keep forgetting its name...

Jarod B 11-13-2009 02:18 AM

I made a script like this for practice, I don't remember exactly what I had, but you would have to use a socket to ping the site, and on the site search it for a specific string. I did it with 2 functions that were small, so this shouldn't be much of a problem to pull off.


All times are GMT. The time now is 08:34 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0