| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Tech Support Join Date: Mar 2005
Posts: 4,944
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Check if a URL exists. Howdy. This simple function will check if a url is valid (going by parse_url()) and if it's 'online' - by seeing if it returns a 302, 301, or 200 status code. EDIT: 3/4/2008, updated to more efficient. PHP Code:
Last edited by SecondVersion; 03-04-2008 at 05:29 PM.
|
| |
| | #2 (permalink) |
| Senior Member Join Date: Jun 2005
Posts: 1,478
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | I needed this a little while ago, and here is what I have: PHP Code: if ($headers[0] == 1) { code } |
| |
| | THREAD STARTER #3 (permalink) | ||||
| Tech Support Join Date: Mar 2005
Posts: 4,944
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| ||||
| |
| | #6 (permalink) | ||||
| Senior Member Join Date: Apr 2005 Location: Joliet, Illinois
Posts: 1,177
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=315565 Then, input this script in to a file called file.php (or whatever_you_want.php) and save and close the file. Now in SecondVersion's script he created the function called $is_valid_url($url); so what you'll want to do to see if a URL exists: (within the same file that the function is in [or if it's included for that matter]) PHP Code: | ||||
| |
| | THREAD STARTER #9 (permalink) | ||||
| Tech Support Join Date: Mar 2005
Posts: 4,944
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| ||||
| |