In case any one is looking for a solution to a similar problem as me, here
is the answer.  I used the code from my original post as my guiding light,
and with some experimentation, I figured it out.

To get any URL, regardless of where it is located, use this:

preg_match_all("#\'http://(.*)\'#U", $content, $matches);

This match anything similar to:

'http://www.domain.com/dir/dir/file.txt?query=blah'

This is useful, if for example, you have a tag like this one:

<A HREF="javascript:void(0);" ONCLICK="javascript:window.open =
'http://www.domain.com/dir/dir/file.txt?query=blah';">

Now, for tags which are in quotes, rather than single quotes, just use:

preg_match_all("#\"http://(.*)\"#U", $content, $matches);


This is really only the first step.

In order to be useful, you need a way to process these urls according to
your own specific needs:

preg_match_all("#\'http://(.*)\'#U", $content, $matches);

$content = preg_replace("#\'http://(.*)\'#U", '###URL###', $content);

This will modify the $content variable to change all urls to ###URL###

You can then go through them one at a time to process them:

for ($count = 0; $count < count($matches[1]); $count++)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to