Jump to content

[SOLVED] Could any body tell me to extract "src" attribute from a <Embed> tag?


phpRoshan

Recommended Posts

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

 

<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?? ???

<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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.