View file wapirate/xhtml/weather.php

File size: 3.43Kb
<?php



include("head.php");

$date = $_GET['date'];

$cnt = $_GET['cnt'];

$wea = $_GET['wea'];

/////////////////////////////main

if($action=="main")

{

addonline(getuid_sid($sid),"Weather!","");

  echo "<div><br/>Weather<br/></div>";



$url="http://weather.sendwap.com/weather.php";

preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);

$domain = "http://" . $matches[2];

$page = $matches[3];

$code = file_get_contents($domain.$page);



$start= strpos($code, "Choose the country:");

$finish= strpos($code, "<a href=\".\">Weather in Europe</a>");

$length= $finish-$start;

$code=substr($code, $start, $length);

$newcode = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $domain . "\\2", $code);







$newcode = str_replace("</p>","",$newcode);

$newcode = str_replace("<p>","",$newcode);

$newcode = str_replace("<a href=\"cnt","<a href=\"weather.php?action=country&amp;cnt=cnt",$newcode);

$newcode = str_replace(".wml","",$newcode);



echo "<p align=\"center\">";

 echo "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>";

  echo "<br/>";

echo "$newcode<br/>";

echo getfoot($sid,$folder);

exit(); 

}

/////////////////////////////////

if($action=="country")

{

addonline(getuid_sid($sid),"Weather!","");

  echo "<div><br/>Weather<br/></div>";



$url="http://weather.sendwap.com/$cnt.wml";

preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);

$domain = "http://" . $matches[2];

$page = $matches[3];

$code = file_get_contents($domain.$page);



$start= strpos($code, "Choose the city:");



$finish= strpos($code, "<a href=\".\">Weather in Europe</a>");

$length= $finish-$start;

$code=substr($code, $start, $length);

$newcode = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $domain . "\\2", $code);

$newcode = str_replace("</p>","",$newcode);

$newcode = str_replace("<p>","",$newcode);





$newcode = str_replace(".wml","",$newcode);

$newcode = str_replace("<a href=\"weather","<a href=\"weather.php?action=weather&amp;wea=weather",$newcode);

$newcode = str_replace("<a href=\"cnt","<a href=\"weather.php?action=country&amp;cnt=cnt",$newcode);

echo "<p align=\"center\">";

 echo "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>";

  echo "<br/>";

echo "$newcode<br/>";

echo "<br/><a href=\"weather.php?action=main\">Back</a><br/><br/>";

echo getfoot($sid,$folder);

exit(); 

}



/////////////////////////////////

if($action=="weather")

{

addonline(getuid_sid($sid),"Weather!","");

  echo "<div><br/>Weather!<br/></div>";



$url="http://weather.sendwap.com/$wea.wml";

preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$url", $matches);

$domain = "http://" . $matches[2];

$page = $matches[3];

$code = file_get_contents($domain.$page);



$start= strpos($code, "weather\">");

$finish= strpos($code, "<p align=\"right\">");



$length= $finish-$start;

$code=substr($code, $start, $length);

$newcode = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $domain . "\\2", $code);



$newcode = str_replace("weather\">","",$newcode);

$newcode = str_replace("</p>","",$newcode);

$newcode = str_replace("<p>","",$newcode);

$newcode = str_replace("<p align=\"center\">","",$newcode);







echo "<p align=\"center\">";

 echo "<img src=\"/smilies/sunny.gif\" alt=\"*\"/><br/>";

  echo "<br/>";

echo "$newcode<br/>";

echo "<br/><a href=\"weather.php?action=main\">Back</a><br/><br/>";

echo getfoot($sid,$folder);

exit(); 

}



?>