TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-27-2009, 06:56 AM   #1 (permalink)
The Wanderer
 
Join Date: Sep 2007
Posts: 11
Thanks: 2
pixelgod is on a distinguished road
Default 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 :)
pixelgod is offline  
Reply With Quote
Old 09-27-2009, 06:52 PM   #2 (permalink)
The Wanderer
Newcomer 
 
etoolbox's Avatar
 
Join Date: Dec 2008
Location: Auckland, NZ
Posts: 24
Thanks: 0
etoolbox is on a distinguished road
Default

http://www.php.net/file_get_contents
http://www.php.net/curl
__________________
Chris Hope's LAMP Blog: http://www.electrictoolbox.com/
etoolbox is offline  
Reply With Quote
Old 09-28-2009, 12:06 AM   #3 (permalink)
The Wanderer
 
Join Date: Sep 2007
Posts: 11
Thanks: 2
pixelgod is on a distinguished road
Default

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
pixelgod is offline  
Reply With Quote
Old 09-28-2009, 12:13 AM   #4 (permalink)
The Wanderer
Newcomer 
 
etoolbox's Avatar
 
Join Date: Dec 2008
Location: Auckland, NZ
Posts: 24
Thanks: 0
etoolbox is on a distinguished road
Default

http://www.php.net/parse_url should do the trick. It's a useful function but I keep forgetting its name...
__________________
Chris Hope's LAMP Blog: http://www.electrictoolbox.com/
etoolbox is offline  
Reply With Quote
Old 11-13-2009, 02:18 AM   #5 (permalink)
The Wanderer
 
Join Date: Aug 2009
Posts: 18
Thanks: 1
Jarod B is on a distinguished road
Default

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.
Jarod B is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a gallery class Tanax Advanced PHP Programming 25 02-19-2013 04:25 AM
interested on a new website ?? webtuto The Lounge 4 04-27-2008 02:01 PM
Tutorial on writing Website Scrapers sunilbhatia79 Script Giveaway 2 02-27-2008 11:19 AM
How to check if a table exists? Haris General 8 09-19-2007 09:04 PM


All times are GMT. The time now is 12:16 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design