View Full Version : Php scrape script showing only blank page

04-08-2011, 08:26 PM
Hi I have a Php screen scrape script that only shows a blank page, it was working before but when we installed noahs classifieds then the problem occured. here is the code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>Weather API</title>
<div id="widget-wrapper"><!-- start widget-wrapper-->
<div class="weather"><!-- start weather-->
<h2><a href="http://www.royalgazette.com/section/weather" title="More on Weather" target="_top">Current Weather</a></h2>

include ('phpQuery.php');

// Create DOM from URL

$html = file_get_html('http://www.weather.bm/');
<a href="http://www.royalgazette.com/section/weather" target="_top">

// find all span tags with class=gb1
$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') );
$div->eq(0)->removeAttr('style')->addClass('day')->html( pq( 'u', $div->eq(0) )->html() ); $div->eq(2)->removeAttr('style')->addClass('description'); } print $doc;
<span class="condition">
<a href="http://www.royalgazette.com/section/weather" title="More on Weather" target="_top"><H4>
$element = $html->find("div");

$element[31]->class = "mwraping31";

foreach($html->find('.mwraping31') as $e)

echo $e->plaintext;

$element = $html->find("div");

$element[28]->class = "mwraping28";

foreach($html->find('.mwraping28') as $e)

echo $e->plaintext;

</div><!-- end weather-->

</div> <!-- end widget-wrapper-->

The weird part is it's working on my other hosting provider
here is my site

here is my other hosting which is working

I am thinking that installing noahsclassifieds might have change some settings in the php but that shouldn't happen. can anyone give me an advice

it even doesn't work on some other script example
http://komunitasweb.com/2009/09/showing-the-weather-with-php-and-google-weather-api/ I just cut and paste it and still I only get blank page. But the authors demo page is working

thanks in advance appreciate your help if you need phpinfo I can give it you

04-08-2011, 10:14 PM
Check your error logs for errors pertaining to this script.
There is almost no standard PHP functionality in what you have provided. Every function and method call is custom, so it could be any or all of these that are causing issues.