Import Page into Div using curl

Hi Everyone,

I am trying to import a page cross-domain into a div using curl. Here’s my code:

[php]<?php
function get_url_contents($url) {
$crl = curl_init();
$timeout = 5;
$useragent = “Googlebot/2.1 (http://www.googlebot.com/bot.html)”;
curl_setopt($crl, CURLOPT_USERAGENT, $useragent);
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($crl, CURLOPT_HEADER, TRUE);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$initOther = curl_exec($crl);
curl_close($crl);
return $initOther;
}
$getOther = get_url_contents(“http://www.somedomain.com/page”);
?>

<?php echo $getOther; ?>
[/php]

It’s bringing in the code, but the beginning html & body tags are missing & body head tags.
Is there a php setting to get them to be bought in?

I know I’m losing classes on the html and the body tags. I’d like it to preview the same as the orig.
FYI - I’d like to use jQuery to further modify the content - just so you know I need to keep it editable on my site.
I’d appreciate some guidance/help on this.

Thanks, Bill

Sponsor our Newsletter | Privacy Policy | Terms of Service