使用curl在div中加载网站

I'm using curl to retrieve an external website and display it in a div...

    function Get_Domain_Contents($url){
        $ch = curl_init();
        $timeout = 5;
        curl_setopt($ch,CURLOPT_URL,$url);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;   
}

but how do I get it to return the css and images of that webpage too? Right now it just returns everything except the images and css. Thanks in advance.

$url = 'http://example.com';

$html = Get_Domain_Contents($url);

$html = "<base href='{$url}' />" . $html;

echo $html;

Rather than download all these extra files, you could parse the content that you downloaded and modify any relative URLs to make them absolute URLs. You'd be using them in place and the CSS and images would be included in the rendered code. You could use something like the PHP simple HTML DOM parser to make parsing part of the task easier.