开发者

Display swf from another website into a div

I’m trying to display a swf from another site into mine.

I’ve got permission from the other side to do so I’m just having problems figuring it all out.

I’d like to display just the swf not the开发者_JAVA技巧 entire page that swf is on.

I’ve tried this – but it only seems to work with content and I haven’t had any luck getting the swf to appear.

<?php $conts = file_get_contents('http://www.test.com/');
$pattern = '~<div.*id="content".*>(.*)</div>~iUs';
preg_match($pattern, $conts, $matches);
array_shift($matches);
echo $matches[0]; ?>

How can a go about doing this. Thanks!


I'm not sure I understand your question :-? but I believe you could use something like this. Create an embed object on your site and in it's src point it to the external swf. Will that work ?


Well, you can't just grab the div that have the SWF, you need to grab the URL of the SWF. For instance, instead of doing this $pattern = '~<div.*id="content".*>(.*)</div>~iUs'; try something like $pattern = '~<embed.*src=".+".*>.*</embed>~iUs';

That way you'll getting the src of the SWF, along with the embed tag, which you can use in your site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜