HTMLHEAD;
if ($_POST["submit"])
$queryn = htmlspecialchars($_POST["queryname"]);
else if ($_GET["queryname"])
$queryn = htmlspecialchars($_GET["queryname"]);
if (isset($queryn))
{
$queryname = str_replace(" ", "%20", trim($queryn));
$queryname = str_replace(array("/", "."), "", $queryname);
if (!$queryname || $queryname == "")
{
$output_str .= "Error with queryname!
\n\n";
unset($queryname);
}
}
if (isset($queryname))
{
$ch = curl_init();
$mini_url = "http://$queryname.myminicity.com/xml";
curl_setopt($ch, CURLOPT_URL, $mini_url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_result = curl_exec($ch);
curl_close($ch);
# Process result
try
{
$citydata = new SimpleXMLElement($curl_result);
}
catch (Exception $e)
{
$e_msg = $e->getMessage();
if ($e_msg == "String could not be parsed as XML")
{
$output_str .= "Error! The most likely cause for this error is that you specified a city that doesn't exist! Please recheck the name "$queryname" for correctness.
\n\n";
}
else
$output_str .= "Unexpected error! Message: $e_msg
\n\nPlease notify the maintainer of this script and provide the message above.
\n\n";
$output_str .= "