HOw DO I use preg_match so that it checks to make sure it has <a href in a link.
Here is what I am using..
$recip = "http://www.mylink.com";
$conts = @file_get_contents($siteurl);
preg_match(?)
preg_match href
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Have a look here: viewtopic.php?t=33147
And here: viewtopic.php?t=40169

If all you're looking for is hyperlinks you should get by OK after a few swear words and a few lost hairs
And here: viewtopic.php?t=40169
If all you're looking for is hyperlinks you should get by OK after a few swear words and a few lost hairs
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Here's the solution my fren !
Cheers,
Dibyendra
Code: Select all
<?php
$url ="http://forums.devnetwork.net/index.php";
if (!preg_match('/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\//i', $url)) {
print "not valid url!";
} else {
print "valid url";
}
?>Cheers,
Dibyendra