Jump to content

Check if url


dreamwest

Recommended Posts

Your going to want to use some regex (regular expression)..

 

http://www.the-art-of-web.com/php/parse-links/

 

<?php
  $search = "http://www.site.com";
   $pattern ='/<a href=\"([^\"]*)\">(.*)<\/a>/iU';
   preg_match($pattern, $search, $matches);
  if(count($matches) > 0){
     echo 'URL found'; 
  }
?>

 

This is a basic example... take a look at the link I gave for a more complicated example.

 

Nate

Link to comment
https://forums.phpfreaks.com/topic/161603-check-if-url/#findComment-852778
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.