View Single Post
  #13  
Unread 07-31-2007, 10:31 AM
Buyirugh's Avatar
Buyirugh Buyirugh is offline
A Dervish Cutthroat
 
Join Date: Sep 2005
Server: Unrest
Posts: 37
Default

Today's downtime gave me a chance to pick up some variables that I had missed before. This is the code for the file network_status.php (for the online/PHP version of the app). I have made changes to the gadget version as well, but until I can figure out how to display the resulting page in a format that is actually viewable, I'm gonna hold onto that. Hopefully by the end of the week I will have a working gadget.

Code:
<html>
<header><title>EQ2 Network Status</title>
<style type="text/css">
	body {
		background-color: #FFFFFF;
		color: #000000;
		font-family:Arial, Helvetica, sans-serif;
		font-size: 10pt;
	}
	
	h1 {
		font-size: 140%;
	}
</style>
</header>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tr><td><h1>EQ2 Network Status</h1></td></tr>
<tr><td>
<?php

$get_server = "eq2players.station.sony.com";
$get_page   = "/en/network_status.vm";

$get_file = fsockopen($get_server, 80, $errno, $errstr, 12);

fputs($get_file, "GET ".$get_page." HTTP/1.0\r\n");
fputs($get_file, "Host: ".$get_server."\r\n");
fputs($get_file, "Referer: http://".$get_server."\r\n");
fputs($get_file, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n\r\n");

//$get_file = fopen("http://".$get_server.$get_page, "r");

while(!feof($get_file)) {
	$get_data .= fread($get_file, 4096);
}

$result_parse1 = explode("<!-- NEW STATUS TOOL -->",$get_data);
$result_parse2 = explode("</td>",$result_parse1[1]);

$dirty_content1 = $result_parse2[0];

$dirty_content2 = str_replace("<span class=\"NewsSelectionHeaders\"><strong>&nbsp;</strong> - &nbsp;</span><br>","",$dirty_content1);

$dirty_content3 = str_replace("<span class=\"server_status_locked\">","<img src=\"images\locked.gif\">&nbsp;&nbsp;",$dirty_content2);

$dirty_content4 = str_replace("<span class=\"serverunavailable\">","<img src=\"images\locked.gif\">&nbsp;&nbsp;",$dirty_content3);

$dirty_content5 = str_replace("<span class=\"serverup\">","<img src=\"images\up.gif\">&nbsp;&nbsp;",$dirty_content4);

$dirty_content6 = str_replace("<span class=\"serverdown\">","<img src=\"images\down.gif\">&nbsp;&nbsp;",$dirty_content5);

$dirty_content6b = str_replace("<span class=\"server_status_down\">","<img src=\"images\down.gif\">&nbsp;&nbsp;",$dirty_content6);

$dirty_content7 = str_replace("(is locked)","",$dirty_content6b);

$dirty_content7b = str_replace("<span class=\"server_status_partial\">All servers are up except for</span>","",$dirty_content7);

$dirty_content8 = str_replace("<span class=\"server_status_all_up\">All Servers Are Up</span><br>","<img src=\"images\up.gif\">&nbsp;&nbsp;Guk<br><img src=\"images\up.gif\">&nbsp;&nbsp;The Bazaar<br><img src=\"images\up.gif\">&nbsp;&nbsp;Lucan DLere<br><img src=\"images\up.gif\">&nbsp;&nbsp;Butcherblock<br><img src=\"images\up.gif\">&nbsp;&nbsp;Nektulos<br><img src=\"images\up.gif\">&nbsp;&nbsp;Kithicor<br><img src=\"images\up.gif\">&nbsp;&nbsp;Unrest<br><img src=\"images\up.gif\">&nbsp;&nbsp;Crushbone<br><img src=\"images\up.gif\">&nbsp;&nbsp;Blackburrow<br><img src=\"images\up.gif\">&nbsp;&nbsp;Najena<br><img src=\"images\up.gif\">&nbsp;&nbsp;Everfrost<br><img src=\"images\up.gif\">&nbsp;&nbsp;Befallen<br><img src=\"images\up.gif\">&nbsp;&nbsp;Permafrost<br><img src=\"images\up.gif\">&nbsp;&nbsp;Mistmoore<br><img src=\"images\up.gif\">&nbsp;&nbsp;Oasis<br><img src=\"images\up.gif\">&nbsp;&nbsp;Venekor PVP<br><img src=\"images\up.gif\">&nbsp;&nbsp;Antonia Bayle<br><img src=\"images\up.gif\">&nbsp;&nbsp;Nagafen PVP<br><img src=\"images\up.gif\">&nbsp;&nbsp;Vox PVP<br>",$dirty_content7b);

$clean_content = str_replace("</div>","",$dirty_content8);

print $clean_content;

?>
</td></tr>
</table>
</body>
</html>
__________________
Reply With Quote