Re: Parse a url for a specific string

From: Date: Tue, 30 Nov 2004 12:15:41 +0000
Subject: Re: Parse a url for a specific string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-203132@lists.php.net to get a copy of this message
Hello web_singer, Tuesday, November 30, 2004, 11:57:33 AM, you wrote: w> I would like to parse a url which is submitted to me for a link to w> check if it already has a link to my site on it. Does anyone know w> if php has a function which would allow me to do this relatively w> easily? You could use a regular expression, but strpos will work just as well: $my_url = 'www.blah.com'; $test = strpos($their_url, $my_url); if ($test === false) { echo 'No link'; } else { echo 'Link is in there somewhere'; } Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I am not young enough to know everything." - Oscar Wilde

« previous php.general (#203132) next »