コード例 #1
0
<?php

require "weatherAPI.php";
//Get Current Weather for Lisboa
/*
$w = new Weather(false);
$w->getWeather("Lisboa, PT");

Debug($w->getCurrent());        //Get Current State
Debug($w->getCity());           //Get City
Debug($w->getTemp());           //Get Current Temp
Debug($w->getTempInterval());   //Get Temp Interval for the day
Debug($w->getCountry());        //Get Country
*/
echo "<hr>";
$city = "Lisboa,PT";
$w = new Weather($city);
$w->getWeather();
echo "<br>";
echo $w->getCurrent();
echo "<br>";
$w->getWeatherForecast();
echo "<br>";
echo "<br>";
コード例 #2
0
        $json = $news->getJSON();
        print $json;
    } else {
        exit;
    }
} else {
    if (isset($_REQUEST["ajaxGetTVGuide"])) {
        $channel = $_REQUEST["ajaxGetTVGuide"];
        $API = new TVApi();
        $API->getChannel(0)->getPrograms($API->getChannel($API->getChannelID($channel))->getSigla() . "&startDate=" . $today . "&endDate=" . $tomorrow);
        print $API->getChannel(0)->getJSON();
    } else {
        if (isset($_REQUEST["ajaxGetWeather"])) {
            $city = $_REQUEST["ajaxGetWeather"];
            $w = new Weather($city);
            $w->getWeather();
            $w->getWeatherForecast();
            $json_forecast = $w->getForecastJSON();
            $curWeather = $w->getCurrent();
            $curTempInterval = $w->getTempInterval();
            $curTemp = $w->getTemp();
            $cur = array();
            array_push($cur, $curWeather, $curTemp, $curTempInterval);
            $rtn = array();
            array_push($rtn, $cur, $json_forecast);
            print json_encode($rtn);
        } else {
            exit;
        }
    }
}