コード例 #1
0
ファイル: Backup.php プロジェクト: Pavan18/WeatherApp
function FetchValue()
{
    if (!empty($_POST["submit"])) {
        $street = $_POST["street"];
        $city = $_POST["city"];
        $state = $_POST["state"];
        $degree = $_POST["degree"];
        echo "<script type='text/javascript'>\n SaveUserInput('" . $street . "','" . $city . "','" . $state . "','" . $degree . "');\n </script>";
        if (!empty($street) && !empty($city) && !empty($state) && !empty($degree)) {
            $GoogleGeoCode = simplexml_load_file("http://maps.google.com/maps/api/geocode/xml?address=" . $street . "," . $city . "," . $state);
            $Location = ParseXml($GoogleGeoCode);
            $Url = "https://api.forecast.io/forecast/e0233df5fb8a3299a02c55c843c4d5dd/" . $Location[0] . "," . $Location[1] . "?units=" . $degree . "&exclude=flag";
            CallJson($Url, $degree);
        }
    }
}
コード例 #2
0
function FetchValue()
{
    if (!empty($_POST["submit"])) {
        $street = $_POST["street"];
        $city = $_POST["city"];
        $state = $_POST["state"];
        $degree = $_POST["degree"];
        echo "<script type='text/javascript'>\n KeepContent('" . $street . "','" . $city . "','" . $state . "','" . $degree . "');\n </script>";
        if (!empty($street) && !empty($city) && !empty($state) && !empty($degree)) {
            $GoogleGeoCode = simplexml_load_file("https://maps.google.com/maps/api/geocode/xml?address=" . $street . "," . $city . "," . $state . "&key=AIzaSyDXJc-HfeU4ZVttzpruI8Q04ZZtzqv4-is");
            $xmlcont = ParseXml($GoogleGeoCode);
            $Url = "https://api.forecast.io/forecast/e0233df5fb8a3299a02c55c843c4d5dd/" . $xmlcont[0] . "," . $xmlcont[1] . "?units=" . $degree . "&exclude=flag";
            CallJson($Url, $degree);
        }
    }
}
コード例 #3
0
<?php

defined('_JEXEC') or die('Restricted access');
require_once __DIR__ . '/flat.php';
$input = JFactory::getApplication()->input;
$file = $input->files->get('file_upload');
$filename = JFile::makeSafe($file['name']);
$info = new SplFileInfo($filename);
$fileType = $info->getExtension();
if (isset($file)) {
    if ($fileType == "xml") {
        $src = $file['tmp_name'];
        $dest = JPATH_BASE . "/modules/mod_flats_loader/uploads/" . $filename;
        if (JFile::upload($src, $dest)) {
            ParseXml($dest);
            unlink($dest);
        } else {
            echo 'no file';
        }
    } else {
        echo 'Only XML files!';
    }
}
function ParseXml($file)
{
    if (file_exists($file)) {
        $xml = simplexml_load_file($file);
        $flatArr = [];
        foreach ($xml->Blocks->Block as $block) {
            $flatObj = new flat();
            $flatObj->id = strval($block['id']);