phpRoshan Posted May 6, 2007 Share Posted May 6, 2007 Hello evrybody, Im a begener level php develope,and i found very hard to extract src" attribute from a <Embed> html tag. I would like to know what techqniq should use to do this. For example i need to ectract whole link including "src=" from <embed style="width:400px; height:326px;" src="http://www.theway.com/v/_ccgbH0YTQA" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed> So how can i acheve this? I would be graeatfull if anybody could tel me. Thank you Quote Link to comment Share on other sites More sharing options...
soycharliente Posted May 7, 2007 Share Posted May 7, 2007 How are you trying to use it? It might be helpful to give some more information. Quote Link to comment Share on other sites More sharing options...
phpRoshan Posted May 7, 2007 Author Share Posted May 7, 2007 Basically i need to store it in a table.And i need to do the same thing for <img> tag also. Quote Link to comment Share on other sites More sharing options...
soycharliente Posted May 8, 2007 Share Posted May 8, 2007 You want to do this in PHP? How is the src being generated? Is it in a database? Is is hard-coded? Quote Link to comment Share on other sites More sharing options...
phpRoshan Posted May 8, 2007 Author Share Posted May 8, 2007 <embed src="...." ></embed> The above html tag is suplied to a text box (copy and past) and what i wanted to extract is only "src=" tag with the "http://..." url . I mean ' src="...." ' both parts. So how can i do this with reg expersions?? ??? Quote Link to comment Share on other sites More sharing options...
effigy Posted May 8, 2007 Share Posted May 8, 2007 <pre> <?php $string = <<<DATA <embed style="width:400px; height:326px;" src="http://www.theway.com/v/_ccgbH0YTQA" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed> DATA; preg_match('/<embed[^>]+?src="(.+?)"/', $string, $matches); // Discard full match. array_shift($matches); print_r($matches); ?> </pre> Quote Link to comment Share on other sites More sharing options...
phpRoshan Posted May 8, 2007 Author Share Posted May 8, 2007 Great Job effigy!! It did my job very well..! Thanks very much! 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.