Example: !weather brisbane, australia"
if (false)
{
mFunction::commandSend("PRIVMSG $username The number of queries must be from 1 to 9.");
}
else
{
$found = false;
// mFunction::commandSend("PRIVMSG $username ".chr(2).chr(3)."4Location: '$location' | URLGen: http://www.google.com/search?q=$location".chr(2).chr(3));
if (true)
{
$num = 1; // this line sets it to get three query
}
echo "\nNum: $num\n";
$query = urlencode(trim($location));
echo "Query: $query\n\n
";
$sock = @fsockopen("www.wunderground.com",80,$errstr,$errno,20); // this line creates a socket on $sock
if(!$sock)
{
die("ERROR: Socket faild to connect."); // this dies if the socket doesnt connect right
}
fwrite($sock, "GET /cgi-bin/findweather/getForecast?query=".$query." HTTP/1.1\r\n"); // this sents the GET HTTP command
fwrite($sock, "Host: www.wunderground.com\r\n"); // this sends the HOST http command
fwrite($sock, "Connection: Close\r\n\r\n"); // this sends to close the connection (HTTP COMMAND)
while(!feof($sock))
{
$rawhtml .= fgets($sock); // this line adds to $rawhtml (.= means to ADD to a variable, not overwrite it) while the connection is still present
}
if ($Search = strstr($rawhtml, "
| ', $forcast[1]);
unset($forcast, $days[0]);
$x = 0;
foreach ($days as $key => $day) // 1,3, 4,6
{
$offset = ($x * 2);
$day = strip_tags($day);
if ($x == 5)
{
$forcastTemp = $forcastTemps[($x + 1)];
$$forcastTemp = str_replace(strstr($forcastTemp, ''), "", $forcastTemp);
}
else
{
$forcastTemp = explode('">',$forcastTemps[($x + 1)]);
$forcastTemp_1 = str_replace(strstr($forcastTemp[1], "<"), "", $forcastTemp[1]);
$forcastTemp_2 = str_replace(strstr($forcastTemp[3], "<"), "", $forcastTemp[3]);
$forcastTemp_3 = str_replace(strstr($forcastTemp[4], "<"), "", $forcastTemp[4]);
$forcastTemp_4 = str_replace(strstr($forcastTemp[6], "<"), "", $forcastTemp[6]);
$forcastTemp = $forcastTemp_1." | ".$forcastTemp_2. " |-:-| ".$forcastTemp_3." | ".$forcastTemp_4;
// echo " \n\rBANG: $BANG \n\r"; } $forcast[$day] = array('temp' => $forcastTemp, 'cond' => $forcastCond, 'percip' => $forcastPercip); $x++; } // FORCAST -> Data Parse print_r($forcast); // print_r($forcast[3]); } // echo $rawhtml; $definition = explode(" |