Theres a few ways to do this.
1. PHP DOM - http://us1.php.net/dom
This doo-hickey will make a XML/XHTML object given the source code you supply. It's kind of a tree like structure that you can traverse through.
2. PHP XML - http://php.net/manual/en/book.xml.php
Just like #1 but an older XML parser.
3. String Literal Searching - http://php.net/manual/en/function.strpos.php
This is an oldey but goody. Use strpos()
to find the source tag start, then again to find the src
tag and hopefully grab the string. It will require that the tags are perfect and doesn't leave a lot of flexibility.
$source = strpos($html, '<source ');
if($source!==FALSE) {
$src_loc = strpos($html, 'src="', $source);
if($src_loc!==FALSE) {
$end_quote = strpos($html, '"', $src_loc + 5);
if($end_quote!==FALSE) {
$final_src = substr($html, $src_loc+5, $end_quote-($src_loc+5)); //TADA!
}
}
}