I am very new to this php stuff (well programming an linux generally) I have this bit of code (that grabs and then displays part of a weather web site on my site -- I do have there permission to do this)
Since I have upgrade to php5 this does not work (nor do a few other scripts I have for rendering rss) I am guessing that this is a problem with the way I have set up my environment. (when I upgraded to php5 I also upgraded to FC4 and changed servers, so lots have changed)
so here is the code
Code: Select all
<link rel="stylesheet" type="text/css" href="http://www.bom.gov.au/standard/stylestd.css">
<link rel="stylesheet" type="text/css" href="http://www.bom.gov.au/standard/datatable.css">
<?
$url="www.bom.gov.au/products/IDN65188.shtml"; //replace with the full URL you wish to fetch the data from
preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);
$domain = "http://" . $matches[2];
$page = $matches[3];
$fd = fopen($domain.$page, "rb");
$code = "";
while(!feof($fd)){
$code .= fread($fd, 4096);
}
fclose($fd);
$start= strpos($code, "</div>"); // replace with your STARTING POINT source of HTML page
$finish= strpos($code, "<!--************* START OF STANDARD BUREAU FOOTER **************-->"); // replace with your END POINT source of HTML page
$length= $finish-$start;
$code=substr($code, $start, $length);
$newcode = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $domain . "\\2", $code);
echo $newcode;
?>and php setting are here
http://www.wildwalks.com/test1.php
I have read through a lot of forums over the last two days trying to solve this, but I am stuck
any ideas will be greatly appreciated. -- thanks
Matt