I have this existing code does not work as I am trying to get flashvars , itemId value to be taken for some purpose. How can I parse and take it?
i need the value itemid = "OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09"
<?php
$result = '<embed src=\'http://www.test.com//test_1.swf\' 开发者_运维知识库quality="high" FlashVars="itemId=OWYrYlg5VW9GZUI4UjVnMXFOUGsrQT09&autoplay=0&duration=02:45&url=http://test.com" bgcolor="#ffffff" wmode="opaque" width="320" height="65" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
//preg_match("/\<embed.*itemId\=\"(.+)\".*\>.*\<\/embed\>/Us",$result,$match);
parse_str($result, $output);
print '<pre>';
print_r ($output);
?>
$result = 'your string';
$output = '';
preg_match('/itemId=([a-zA-Z0-9]+)/', $result, $matches);
$output = $matches[1];
preg_match("!<embed.*?itemId=([^&]+).*?>.*?</embed>!sm",$result,$match);
精彩评论