iceman400 Posted March 6, 2007 Share Posted March 6, 2007 whats the best (and easiest) way to parse a ful or partial URL (meaning with http:// or just a filename) from a <a href="...."> tag? i had a few ideas but none of them is very good and probably wont wok in all cases. thanx 4 ur help Link to comment https://forums.phpfreaks.com/topic/41428-prasing-a-url-from-html/ Share on other sites More sharing options...
ToonMariner Posted March 6, 2007 Share Posted March 6, 2007 ?? Remeber php is server side so its all done and gone to bed by the time the browser sees the html. If you want to parse url's before you send out the html then use a regular expression to grab all the href's and do what you want with them. If you want to manipulate based on what the client has done then you'll need javascript or ajax to perform the same task... Link to comment https://forums.phpfreaks.com/topic/41428-prasing-a-url-from-html/#findComment-200731 Share on other sites More sharing options...
iceman400 Posted March 6, 2007 Author Share Posted March 6, 2007 im sorry i should made myself clear. i need to extract URL's from other website source code. so i use fopen() read the contents into an array....and how do i get the URL's out of all the HTML? Link to comment https://forums.phpfreaks.com/topic/41428-prasing-a-url-from-html/#findComment-200736 Share on other sites More sharing options...
trq Posted March 6, 2007 Share Posted March 6, 2007 preg_match() should help. Link to comment https://forums.phpfreaks.com/topic/41428-prasing-a-url-from-html/#findComment-200739 Share on other sites More sharing options...
iceman400 Posted March 6, 2007 Author Share Posted March 6, 2007 thanx alot for the link! php.net actually have the code i need as an example ;D great help Link to comment https://forums.phpfreaks.com/topic/41428-prasing-a-url-from-html/#findComment-200747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.