How to extract link when given partial link value
- by mrjames
hi, I am using PHP 4, that is what the host has at the moment. How can I extract link from a string when given part of the link to find.
Example
$find_string = 'http://www.mysite.com/apple';
$string = 'Something and something else < a href="http://www.mysite.com/apple_banana"testlink< /a something else and so forth < a href="http://www.mysite.com/orange"orange< /a
In this case I would like to extract only the links that has http:// www.mysite.com/apple in it so it would retrieve http://www.mysite.com/apple_bananan
Any help would be greatly appreciated.