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 Quote Link to comment 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... Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
trq Posted March 6, 2007 Share Posted March 6, 2007 preg_match() should help. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.