gibigbig Posted October 3, 2010 Share Posted October 3, 2010 The bulk code i have looks like this: function setembedcode(cwidth,cheight) { document.getElementById('embedcode').value = '<object width="' + cwidth + '" height="' + cheight + '"><param name="movie" value="http://www.megavideo.com/v/ZDWFCCMEf5a91463ba9f5539ffffde18eaa9acbf"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.megavideo.com/v/ZDWFCCMEf5a91463ba9f5539ffffde18eaa9acbf" type="application/x-shockwave-flash" allowfullscreen="true" width="' + cwidth + '" height="' + cheight + '"></embed></object>'; } and I need a regular expression to match ONLY the http://www.megavideo.com/v/ZDWFCCMEf5a91463ba9f5539ffffde18eaa9acbf Can anyone help me? My current code is : $embed = file_get_contents($stream_link); preg_match_all( '/http\:\/\/www\.megavideo\.com\/v\/(.*)\"\>/i', $embed, $matches, PREG_SET_ORDER); foreach($matches as $txt){ echo $txt[0].'<br />'; } Link to comment https://forums.phpfreaks.com/topic/215050-urgent-help-needed-for-grabbing-megavideo-code/ Share on other sites More sharing options...
sasa Posted October 4, 2010 Share Posted October 4, 2010 try $embed = file_get_contents($stream_link); preg_match_all( '/"(http\:\/\/www\.megavideo\.com\/v\/[^"]*)"/i', $embed, $matches, PREG_SET_ORDER); foreach($matches[1] as $txt){ echo $txt.'<br />'; } Link to comment https://forums.phpfreaks.com/topic/215050-urgent-help-needed-for-grabbing-megavideo-code/#findComment-1118784 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.