# get a document from a remote server $fp = fopen("http://www.nyiso.com/javascript/writeSystemLoad.js","r"); while(!feof($fp)){ $contents .= fgets($fp,1024); } fclose($fp); # clean it up a little $c2 = strip_tags($contents); # Get rid of HTML tags! $c3 = str_replace("document.write('","",$c2); $c4 = str_replace("');","",$c3); $c5 = str_replace("function writeSystemLoad()","",$c4); $c6 = str_replace("{","",$c5); $c7 = str_replace("}","",$c6); $c8 = str_replace("\n"," ",$c7); $c9 = str_replace(" "," ",$c8); $c10 = stristr($c9,"Area"); $c11 = str_replace("Area","",$c10); $parts = split("megawatts",$c11); $megawatts = trim($parts[0]); $date = trim($parts[1]); header("Content-type: text/plain"); print("$megawatts -------- $date"); ?> function writeSystemLoad() { document.write('
');
document.write('Real-Time Load for the New York Control Area '); document.write(' |
19810 '); document.write('megawatts |
'); document.write('10/23/2001 17:35:30 EDT |