php - Creating a container for cURL'd content -
i'm using curl page. problem is, i'm trying have own "header" div curl content @ bottom. css curl messing formatting though. how contain curl'd content without putting in iframe?
public function curl ($url, $options) { $handle = curl_init($url); curl_setopt_array($handle, $options); ob_start(); $buffer = curl_exec($handle); ob_end_clean(); curl_close($handle); return $buffer; }
you can try this:
$content = curl($url, $options = array()); preg_match('/<body>(.*?)</body>/is', $content, $matches); if(!empty($matches)) { $body = $matches[0]; //header css echo $header; //parsed content echo $body; //footer echo $footer; }
note: code not tested.
hope helps.
Comments
Post a Comment