Jazz00006
Jul 10th, 2006, 11:03 PM
how would i (in php) get all the info between these two functions from a webpage?
<?php
$Page = fopen("http://www.bom.gov.au/","r");
//<div id="pad">
//</div>
function remover($string, $sep1, $sep2)
{
$string = substr($string, 0, strpos($string,$sep2));
$string = substr(strstr($string, $sep1), 1);
return $string;
}
$str1 = "<div id=""pad"">";
$str2 = "</div>";
echo remover($Page, $str1, $str2);
?>
I also edited it a bit further and ended up with nothing much more,
<title>Test PHP script</title>
<meta http-equiv="refresh" content="60">
</head><body>
<p><strong>Current Forecast for today; </strong></p>
<p>
<?php
$Page = fopen("http://www.bom.gov.au/","r");
if($Page){
while (!feof($Page)) {
$contents .= fread($Page, 8192);}
fclose($Page);}
/*
Note
Weather:
Gets from <div id="pad"> to </div> from the BOM website.
Clock:
http://www.worldtimeserver.com/clocks/wtsclock001.swf?color=00FF00&wtsid=US-UT
Based on original SWF file, all changes are in the inside the file.
wtsid=AU-SA is South Australia, Australia
*/
function GetForecast($string, $sep1, $sep2)
{
$string = substr($string, 0, strpos($string,$sep2));
$string = substr(strstr($string, $sep1), 1);
return $string;
}
/*
function GetRank($skill)
{ $str1 = strstr($GLOBALS['contents'], '>'.$skill.'<');
if(strpos($str1, 't"')>40){return '';}
$pos1 = strpos($str1, 't"')+3;
return substr($str1, $pos1, strpos($str1,'<',$pos1)-$pos1);}
*/
//echo GetForecast($Page, "<div id=""pad"">","</div>");
//Boring image
?>
</p>
<p> </p>
<p> </p>
<p><?php
//Beginning
//
//<div class="annotation" style="margin: 2px 0pt;">or Click map, to link to weather area </div>
//
//
//End
//
//"<table"
//Echo image
?>
</body>
</html>
please, ive tried this but it wont work properly, can any one help?
cheers ;)
i couldnt figure out how to delete a post so i just marked it resolved. its fixed btw ;)
<?php
$Page = fopen("http://www.bom.gov.au/","r");
//<div id="pad">
//</div>
function remover($string, $sep1, $sep2)
{
$string = substr($string, 0, strpos($string,$sep2));
$string = substr(strstr($string, $sep1), 1);
return $string;
}
$str1 = "<div id=""pad"">";
$str2 = "</div>";
echo remover($Page, $str1, $str2);
?>
I also edited it a bit further and ended up with nothing much more,
<title>Test PHP script</title>
<meta http-equiv="refresh" content="60">
</head><body>
<p><strong>Current Forecast for today; </strong></p>
<p>
<?php
$Page = fopen("http://www.bom.gov.au/","r");
if($Page){
while (!feof($Page)) {
$contents .= fread($Page, 8192);}
fclose($Page);}
/*
Note
Weather:
Gets from <div id="pad"> to </div> from the BOM website.
Clock:
http://www.worldtimeserver.com/clocks/wtsclock001.swf?color=00FF00&wtsid=US-UT
Based on original SWF file, all changes are in the inside the file.
wtsid=AU-SA is South Australia, Australia
*/
function GetForecast($string, $sep1, $sep2)
{
$string = substr($string, 0, strpos($string,$sep2));
$string = substr(strstr($string, $sep1), 1);
return $string;
}
/*
function GetRank($skill)
{ $str1 = strstr($GLOBALS['contents'], '>'.$skill.'<');
if(strpos($str1, 't"')>40){return '';}
$pos1 = strpos($str1, 't"')+3;
return substr($str1, $pos1, strpos($str1,'<',$pos1)-$pos1);}
*/
//echo GetForecast($Page, "<div id=""pad"">","</div>");
//Boring image
?>
</p>
<p> </p>
<p> </p>
<p><?php
//Beginning
//
//<div class="annotation" style="margin: 2px 0pt;">or Click map, to link to weather area </div>
//
//
//End
//
//"<table"
//Echo image
?>
</body>
</html>
please, ive tried this but it wont work properly, can any one help?
cheers ;)
i couldnt figure out how to delete a post so i just marked it resolved. its fixed btw ;)