<?
function get_item($url, $start, $end) {
global $item;
if(!($fp=fopen($url,"r"))) {
echo $url." is not accessable";
exit;
}
while(!feof($fp)) {
$item.=fgets($fp,255);
}
fclose($fp);
$start_position=strpos($item, $start)+strlen($start);
$end_position=strpos($item, $end);
$length=$end_position-$start_position;
$item=substr($item, $start_position, $length);
}
echo $item;
?>
Tom Culpepper
Multicast Technologies
Adam wrote:
someone gave me the following expression which uses another program and it works fine for them... is there something similar with php?wget --timeout=90 -q -O- http://www.BoM.GOV.AU/products/IDO30V01.shtml | sed '1,/>Melbourne <sup/d' | sed '1d;3,$d;s/.*">//;s/<.*//' thanks, adam. "Evan Nemerson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 If the target is in well-formed XML (XHTML is an example), you could useXSLTto say 'i want the third column of a particular row - in this instance, Melbourne'. However, since few people actually adhere to standards, you're probably going to need a regex... if you're not comfortable with them, explode() could be useful (although it is slower) Somebody posted an extremely helpfull little quick reference atphp.net/ereg,i think... that might help you. On Friday 22 November 2002 01:40 pm, Adam wrote:I have the following website that i want to grab info from: http://www.bom.gov.au/products/IDV60034.shtml Say I wanted the current temperature for Melbourne from this table, what line of code would I need to tell it to get that info - ie, an ereg() expression... i'm wondering whether there are ways of saying "i want the third columnofa particular row - in this instance, Melbourne"? Thanks for any help. Adam.- -- I pledge allegiance to the flag, of the United States of America, and totherepublic for which it stands, one nation indivisible, with liberty, and justice for all. - -Pledge of Allegiance -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE93qVm/rncFku1MdIRAshSAJ9phj0DqR3seanlzKXhdnKj8cvI8QCfW7kM tfUfUEF4yVJSRnm0GCkIeaM= =AyI1 -----END PGP SIGNATURE-----
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php