dongnai3960 2011-05-02 02:12
浏览 169
已采纳

使用PHP文件加载外部网站

I'm using JQuery to resize an iframe to make it have the same height as it's content, it works perfectly though it only works if the content is in the same domain.

I need to display external content so I'm making the iframe point to a file in my server which in turn should display the external content:

<iframe src="frame.php" scrolling="no" frameborder="0" noresize="noresize" style="width:100%; border: 1px solid black;">

How do I make frame.php display the content of the external domain?

In case you need more info here is the answer on how to do it (he explains everything excepts how to display content in the php file): AutoHeight IFrame

Thanks

  • 写回答

3条回答 默认 最新

  • duanheye7423 2011-05-02 02:34
    关注

    So you want to fetch the contents of an external site?

    This will work, but it'll break the layout when the target page has non-absolute URLs and relative links:

    frame.php:

    <?php
    
    echo file_get_contents($_GET['url']);
    
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 我想在一个软件里添加一个优惠弹窗,应该怎么写代码
  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流