using curl with simplehtmldom

feliponI

New Member
Recently our hosting disabled allow_url_fopen, it seems simplehtmldom needs it turned on I saw a work arround with allow_url_fopen in this site simplehtmldom.sourceforge.net...aq.htm#hosting, "Use curl to get the page, then call "str_get_dom" to create DOM object". but still to no luck. can you tell me if I did it properly or am I missing something?\[code\]<?php $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'www.weather.bm/'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); $str = curl_exec($curl); curl_close($curl); $html= str_get_html($str); ?> <?php $element = $html->find("div"); $element[66]->class = "mwraping66"; foreach($html->find('.mwraping66 img') as $e) $doc = phpQuery::newDocumentHTML( $e ); $containers = pq('.mwraping66', $doc); foreach ( $containers as $container ) { $div = pq('img', $container); $div->eq(1)->removeAttr('style')->addClass('thumbnail')->html( pq( 'img', $div->eq(1))- >removeAttr('height')->removeAttr('width')->removeAttr('alt') ); } print $doc; ?> <?php $element = $html->find("div"); $element[31]->class = "mwraping31"; foreach($html->find('.mwraping31') as $e) echo $e->plaintext; ?>................................. \[/code\]compared to: \[code\]<?php include('simple_html_dom.php'); include ('phpQuery.php'); // Create DOM from URL $html = file_get_html('www.weather.bm/'); ?> <?php $element = $html->find("div"); $element[66]->class = "mwraping66"; foreach($html->find('.mwraping66 img') as $e).....\[/code\]Thanks you for your help
 
Top