php.ajax.coder Posted March 10, 2009 Share Posted March 10, 2009 I have go a list of links like below <a href="http://www.google.com" ></a> <a href = "http://www.google.com" ></a> <a href = 'http://www.google.com' ></a> <a href=http://www.google.com ></a> How would you recommend to get the URL from all the possibles using php e.g. http://www.google.com/ Thanks Link to comment https://forums.phpfreaks.com/topic/148742-solved-getting-urls/ Share on other sites More sharing options...
aschk Posted March 10, 2009 Share Posted March 10, 2009 One word: regex (regular expressions). Something like: $regex = "@<a[^>]+href=([^>]+)>@i"; preg_match_all($regex, $subject, $matches); Try it and see, I make no guarantees... Link to comment https://forums.phpfreaks.com/topic/148742-solved-getting-urls/#findComment-781017 Share on other sites More sharing options...
php.ajax.coder Posted March 10, 2009 Author Share Posted March 10, 2009 Thanks it seams to be working Link to comment https://forums.phpfreaks.com/topic/148742-solved-getting-urls/#findComment-781032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.