是否可以将iframe用作“代理”?

时间:2012-01-06 01:37:01

标签: html iframe proxy

我想在我的网站上加载整个网页的内容。使用cURL检索HTML内容。

标题声明proxy。这不是我的目标,但这就是它的基本原理。

是否有可能在iframe中加载内容以显示而不是使用src属性?

<iframe class="output">
<?php echo $content; ?>
</iframe>

Example of the HTML我检索并the page with the iframe我想加载内容。

如果不可能(我怀疑)将采取另一种方式(一个'真正的'框架???)。

1 个答案:

答案 0 :(得分:4)

您可以使用php将检索到的html写入文件,然后将该临时文件设置为iframe的src。

或者,结合使用javascript来发布处理html,如:

function callthisonload(){ 

   var iFrame = document.getElementById('youriFrameID');

   iFrame.outerHTML = '<?php echo $curlReponseContents; ?>';

}