当前位置: 首页>>代码示例>>PHP>>正文


PHP Logging::lclose方法代码示例

本文整理汇总了PHP中Logging::lclose方法的典型用法代码示例。如果您正苦于以下问题:PHP Logging::lclose方法的具体用法?PHP Logging::lclose怎么用?PHP Logging::lclose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logging的用法示例。


在下文中一共展示了Logging::lclose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processAPI

 public function processAPI()
 {
     if ($this->sqlInjection($_SERVER['REQUEST_URI'])) {
         $log = new Logging();
         $log->lfile('/var/www/web1162/html/tankUp/log_error.txt');
         $log->lwrite("SQL_Injection?: " . $_SERVER['REQUEST_URI']);
         $log->lclose();
         return $this->_response("Unexpected Parameters", 400);
     }
     if ((int) method_exists($this, $this->endpoint) > 0) {
         return $this->_response($this->{$this->endpoint}($this->args));
     }
     return $this->_response("No Endpoint: {$this->endpoint}", 404);
 }
开发者ID:robertlange81,项目名称:Website,代码行数:14,代码来源:AbstractApi.php

示例2: GetDataByCoords

 public function GetDataByCoords($article, $distance, $sortBy, location $coords)
 {
     try {
         $log = new Logging();
         $log->lfile('/var/www/web1162/html/tankUp/log_debug.txt');
         $log->lwrite($article . $distance . $sortBy . $coords->latitude . $coords->longitude);
         $log->lclose();
         $param = new GetDataByCoordsRequest($article, $distance, $coords, $sortBy);
         $response = $this->__construct()->__soapCall("getDataByCoords", array($param));
         return $response->petrolStation;
     } catch (Exception $e) {
         // Umwandlung Soap-Exception zu HTTP
         return $e;
     }
 }
开发者ID:robertlange81,项目名称:Website,代码行数:15,代码来源:soapclient.php

示例3: run

 public function run()
 {
     $log = new Logging();
     //        $parenClass = new ParentClass();
     // set path and name of log file (optional)
     $log->lfile('log.txt');
     $json = file_get_contents('php://input');
     $log->lwrite("post: " . $json);
     $update = new Update($json);
     $message = $update->getMessage();
     $chat = $message->getChat();
     $chat_id = $chat->getId();
     $text = $message->getText();
     $client = new Client();
     $client->sendMessage($chat_id, $text, null, null, null);
     $client->sendLocation($chat_id, 53.480759, -2.242631, null, null);
     $client->sendPhoto($chat_id, 'pic.jpg', 'sweety', null, null);
     $log->lclose();
 }
开发者ID:raniongolu,项目名称:Telegram-Bot-Client,代码行数:19,代码来源:index.php

示例4: GetTownByCoords

 private function GetTownByCoords(location $loc)
 {
     $town = null;
     // TODO Fehler
     $db_id = mysql_connect("localhost", "web1162", "bX2KARTc");
     if (!$db_id) {
         die("Verbindungsaufbau ist gescheitert");
     }
     try {
         $arg2 = $loc->latitude;
         $arg1 = $loc->longitude;
         $log = new Logging();
         $log->lfile('/var/www/web1162/html/tankUp/log_debug.txt');
         $log->lwrite("FuelApi_v2: " . $arg2);
         $log->lclose();
     } catch (Exception $ex) {
         return new Exception("Server", "Error converting location : " . $ex);
     }
     // mysql_query("use usr_web_1162_4");
     $db_sel = mysql_select_db("usr_web1162_4", $db_id);
     if (!$db_sel) {
         die('Kann Datenbank nicht benutzen : ' . mysql_error());
     }
     mysql_query("SET names 'utf8'");
     mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $db_id);
     $locRecords = mysql_query("SELECT data.loc_id as id, data.text_val as ort, ACOS( SIN( RADIANS( src.lat ) ) * SIN( RADIANS( '{$arg2}' ) ) + COS( RADIANS( src.lat ) ) * COS( RADIANS( '{$arg2}' ) ) * COS( RADIANS( src.lon ) - RADIANS( '{$arg1}' ) ) ) *6380 AS distance\n\t\t\t\t\t\t\t\t\t\t\t FROM geodb_coordinates src, geodb_textdata data\n\t\t\t\t\t\t\t\t\t\t\t WHERE src.lat > '{$arg2}' - 0.4\n\t\t\t\t\t\t\t\t\t\t\t AND src.lat < '{$arg2}' + 0.4\n\t\t\t\t\t\t\t\t\t\t\t AND src.lon > '{$arg1}' - 0.4\n\t\t\t\t\t\t\t\t\t\t\t AND src.lon < '{$arg1}' + 0.4\n\t\t\t\t\t\t\t\t\t\t\t AND data.loc_id = src.loc_id\n\t\t\t\t\t\t\t\t\t\t\t AND data.text_type = 500100000\n\t\t\t\t\t\t\t\t\t\t\t HAVING distance <5\n\t\t\t\t\t\t\t\t\t\t\t ORDER BY distance asc\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 1");
     if (mysql_num_rows($locRecords) >= 1) {
         while ($aktZeile = mysql_fetch_assoc($locRecords)) {
             $town = $aktZeile['ort'];
             break;
         }
     }
     return $town;
 }
开发者ID:robertlange81,项目名称:Website,代码行数:34,代码来源:FuelApi.php

示例5: getDataByCoord

function getDataByCoord($params)
{
    $lat;
    $lon;
    $art;
    $umkreis;
    $sortieren;
    try {
        $lat = $params->getParam(0)->scalarval();
        $lon = $params->getParam(1)->scalarval();
        $art = $params->getParam(2)->scalarval();
        $umkreis = $params->getParam(3)->scalarval();
        $sortieren = $params->getParam(4)->scalarval();
    } catch (Exception $fault) {
        return new Exception("Server", "Error converting params getDataByCoords : " . $fault);
    }
    if ($log == null) {
        $log = new Logging();
    }
    $log->lfile('log_info.txt');
    $log->lwrite("Aufruf getDataByCoord mit Artikel " . $art . " , Umkreis: " . $umkreis . " , Sortieren nach: " . $sortieren . " , Long: " . $lon . " , Lat: " . $lat . ".");
    $log->lclose();
    $db_id = mysql_connect("localhost", "web1162", "bX2KARTc");
    if (!$db_id) {
        die("Verbindungsaufbau ist gescheitert");
    }
    $db_sel = mysql_select_db("usr_web1162_3", $db_id);
    if (!$db_sel) {
        die('Kann Datenbank nicht benutzen : ' . mysql_error());
    }
    mysql_query("SET names 'utf8'");
    mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $db_id);
    try {
        $priceRecords = null;
        $basequery = "select distinct TIME_FORMAT(ot.startTimeOfPeriod,'%H:%i') as ab, TIME_FORMAT(ot.endTimeOfPeriod,'%H:%i') as bis,\n    \t\t\t\t\t\t\t\t\t\t\t\t\t(select CASE WHEN CURRENT_TIME BETWEEN ot.startTimeOfPeriod\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ot.endTimeOfPeriod\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tthen 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) as open,\n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . $art . " , a.id, a.petrolStationBrand, a.petrolStationStreet, a.petrolStationHouseNumber, a.petrolStationPostcode, a.petrolStationPlace, a.petrolStationVersionTime, a.longitude as AnbietGPSLaenge, a.latitude as AnbietGPSBreite, ACOS( SIN( RADIANS( a.latitude ) ) * SIN( RADIANS( '{$lat}' ) ) + COS( RADIANS( a.latitude ) ) * COS( RADIANS( '{$lat}' ) ) * COS( RADIANS( a.longitude ) - RADIANS( '{$lon}' ) ) ) *6380 AS 'distance'\n\t\t\t\t\t\t\t\t\t\t \n\t \t\t\t\t\t\t\t\t\t\t\t\t\tfrom ( select Max(`version`) as newest \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom `fuelPrice` \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroup by `id` ) plNewest, \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t`fuelPrice` pl, `petrolStation` a, `openingTimes` ot\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere a.latitude > '{$lat}' - 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.latitude < '{$lat}' + 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.longitude > '{$lon}' - 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.longitude < '{$lon}' + 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tand pl.`version` = plNewest.newest\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand a.`id` = pl.`id` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand ot.applicableDay = (SELECT DAYNAME( CURDATE( ) ) )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand ot.fid = a.id\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand " . $art . " > 0 \t\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\thaving distance < '{$umkreis}' ";
        if (strpos($sortieren, 'preis') !== false) {
            $priceRecords = mysql_query($basequery . " order by {$art}, distance limit 7");
        } else {
            if (strpos($sortieren, 'distanz') !== false) {
                $priceRecords = mysql_query($basequery . " order by distance limit 7");
            }
        }
        if (mysql_num_rows($priceRecords) >= 1) {
            $petrolStationList = array();
            /* Tankstelle ermitteln */
            while ($aktZeile = mysql_fetch_assoc($priceRecords)) {
                $location = new location($aktZeile['AnbietGPSBreite'], $aktZeile['AnbietGPSLaenge']);
                $address = new address($aktZeile['petrolStationStreet'], $aktZeile['petrolStationHouseNumber'], $aktZeile['petrolStationPostcode'], $aktZeile['petrolStationPlace']);
                $petrolStation = new petrolStation($aktZeile['id'], $aktZeile['petrolStationBrand'], $aktZeile['open'], $aktZeile['ab'], $aktZeile['bis'], $location, $aktZeile[$art], $address, $aktZeile['petrolStationVersionTime'], $aktZeile['distance']);
                array_push($petrolStationList, $petrolStation);
            }
        } else {
            echo "Keine Ergebnisse";
        }
    } catch (SoapFault $fault) {
        return new SoapFault("Server", "Error reading town by coord. " . $fault);
    }
    $petrolStationArray = array();
    // $petrolStationList.count
    $count = 0;
    $resp = new jsonrpcresp(new jsonrpcval("no data", 'string'));
    if ($petrolStationList != null) {
        foreach ($petrolStationList as $station) {
            $petrolStation = array('owner' => new jsonrpcval(umlaute_ersetzen($station->owner), 'string'), 'isOpen' => new jsonrpcval($station->isOpen, 'boolean'), 'openFrom' => new jsonrpcval($station->openFrom . "", 'string'), 'openTo' => new jsonrpcval($station->openTo . "", 'string'), 'longitude' => new jsonrpcval($station->location->longitude, 'double'), 'latitude' => new jsonrpcval($station->location->latitude, 'double'), 'price' => new jsonrpcval($station->price, 'string'), 'street' => new jsonrpcval(umlaute_ersetzen($station->address->street), 'string'), 'housenumber' => new jsonrpcval($station->address->housenumber, 'string'), 'postal' => new jsonrpcval($station->address->postal, 'string'), 'place' => new jsonrpcval(umlaute_ersetzen($station->address->place), 'string'), 'reporttime' => new jsonrpcval($station->reporttime . "", 'string'), 'distance' => new jsonrpcval($station->distance, 'double'), 'id' => new jsonrpcval($station->id, 'double'));
            array_push($petrolStationArray, new jsonrpcval($petrolStation, 'struct'));
            $count += 1;
        }
        $resp = new jsonrpcresp(new jsonrpcval($petrolStationArray, 'struct'));
        $resp->content_type = "text/json; charset=iso-8859-1";
        //$resp->serialize('UTF-8');
    }
    return $resp;
}
开发者ID:robertlange81,项目名称:Website,代码行数:73,代码来源:jsonrpcserver_alt.php

示例6:

                                    zway_switch_set($ch, $unit, $zway_dev[$i]['gui_old']);
                                    // Set back to the old value
                                    $zway_dev[$i]['gui_inValid'] = 0;
                                    $log->lwrite("ERROR: Switch corrected:: " . $zway_dev[$i]['name'] . " gui_old: " . $zway_dev[$i]['gui_old'] . ", gui_val: " . $gui_val . ", zway_val: " . $zway_val, 0);
                                }
                            }
                        }
                    }
                    break;
                case "sensor":
                    $log->lwrite("\tSensor for device id: " . $i . " not yet implemented, zway id: " . $unit, 2);
                    break;
                case "thermostat":
                    $log->lwrite("\tThermostat for device id: " . $i . " not yet implemented, sway id: " . $unit, 2);
                    break;
                default:
                    $log->lwrite("\tZway unknown type: " . $dev_config[$i]['type'], 1);
            }
            // switch
            // Print the status
            $log->lwrite("device: " . $dev_config[$i]['name'] . ", unit: " . $unit . ": gui old: " . $zway_dev[$i]['gui_old'] . ", gui val: " . $gui_val . ", zway val: " . $zway_val . ", inValid: " . $zway_dev[$i]['gui_inValid'], 2);
        } else {
        }
        // brand==ZWAVE
    }
    // for
}
// while
$log->lwrite("Closing LamPI-gate");
$log->lclose();
flush();
开发者ID:RobQuistNL,项目名称:LamPI-2.0,代码行数:31,代码来源:LamPI-gate.php

示例7: getDataByCoordsRPC

function getDataByCoordsRPC(GetDataByCoordsRequest $reqt)
{
    $response = null;
    $lat;
    $lon;
    $art;
    $umkreis;
    $sortieren;
    try {
        $loc = $reqt->location;
        $lat = $loc->latitude;
        $lon = $loc->longitude;
        $art = $reqt->article;
        $umkreis = $reqt->distance;
        $sortieren = $reqt->sortBy;
    } catch (SoapFault $fault) {
        return new SoapFault("Server", "Error converting GetDataByCoordsRequest : " . $fault);
    }
    if ($log == null) {
        $log = new Logging();
    }
    $log->lfile('/var/www/web1162/html/tankUp/log_debug.txt');
    $log->lwrite("Aufruf getDataByCoord mit Artikel " . $reqt->article . " , Umkreis: " . $reqt->distance . " , Sortieren nach: " . $reqt->sortBy . " , Long: " . $lon . " , Lat: " . $lat . ".");
    $log->lclose();
    $db_id = mysql_connect("localhost", "web1162", "bX2KARTc");
    if (!$db_id) {
        die("Verbindungsaufbau ist gescheitert");
    }
    // mysql_query("use usr_web_1162_3");
    $db_sel = mysql_select_db("usr_web1162_3", $db_id);
    if (!$db_sel) {
        // close log file
        $log->lclose();
        die('Kann Datenbank nicht benutzen : ' . mysql_error());
    }
    mysql_query("SET names 'utf8'");
    mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $db_id);
    try {
        $priceRecords = null;
        $basequery = "select distinct TIME_FORMAT(ot.startTimeOfPeriod,'%H:%i') as ab, TIME_FORMAT(ot.endTimeOfPeriod,'%H:%i') as bis,\n    \t\t\t\t\t\t\t\t\t\t\t\t\t(select CASE WHEN CURRENT_TIME BETWEEN ot.startTimeOfPeriod\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND ot.endTimeOfPeriod\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tthen 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) as open,\n    \t\t\t\t\t\t\t\t\t\t\t\t\t" . $art . " , a.id, a.petrolStationBrand, a.petrolStationStreet, a.petrolStationHouseNumber, a.petrolStationPostcode, a.petrolStationPlace, a.petrolStationVersionTime, a.longitude as AnbietGPSLaenge, a.latitude as AnbietGPSBreite, ACOS( SIN( RADIANS( a.latitude ) ) * SIN( RADIANS( '{$lat}' ) ) + COS( RADIANS( a.latitude ) ) * COS( RADIANS( '{$lat}' ) ) * COS( RADIANS( a.longitude ) - RADIANS( '{$lon}' ) ) ) *6380 AS 'distance'\n\t\t\t\t\t\t\t\t\t\t \n\t \t\t\t\t\t\t\t\t\t\t\t\t\tfrom ( select Max(`version`) as newest \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom `fuelPrice` \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgroup by `id` ) plNewest, \n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t`fuelPrice` pl, `petrolStation` a, `openingTimes` ot\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere a.latitude > '{$lat}' - 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.latitude < '{$lat}' + 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.longitude > '{$lon}' - 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tAND a.longitude < '{$lon}' + 0.4\n\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\tand pl.`version` = plNewest.newest\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand a.`id` = pl.`id` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand ot.applicableDay = (SELECT DAYNAME( CURDATE( ) ) )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand ot.fid = a.id\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\tand " . $art . " > 0 \t\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\thaving distance < '{$umkreis}' ";
        if (strpos($sortieren, 'preis') !== false) {
            $priceRecords = mysql_query($basequery . " order by {$art}, distance limit 7");
        } else {
            if (strpos($sortieren, 'distanz') !== false) {
                $priceRecords = mysql_query($basequery . " order by distance limit 7");
            } else {
                $priceRecords = mysql_query($basequery . " order by distance limit 7");
            }
        }
        $petrolStationList = array();
        if (mysql_num_rows($priceRecords) >= 1) {
            /* Tankstelle ermitteln */
            while ($aktZeile = mysql_fetch_assoc($priceRecords)) {
                $location = new location($aktZeile['AnbietGPSBreite'], $aktZeile['AnbietGPSLaenge']);
                $address = new address($aktZeile['petrolStationStreet'], $aktZeile['petrolStationHouseNumber'], $aktZeile['petrolStationPostcode'], $aktZeile['petrolStationPlace']);
                $petrolStation = new petrolStation($aktZeile['id'], $aktZeile['petrolStationBrand'], $aktZeile['open'], $aktZeile['ab'], $aktZeile['bis'], $location, $aktZeile[$art], $address, $aktZeile['petrolStationVersionTime'], $aktZeile['distance']);
                array_push($petrolStationList, $petrolStation);
            }
        }
    } catch (SoapFault $fault) {
        return new SoapFault("Server", "Error reading town by coord. " . $fault);
    }
    return new GetDataByCoordsResponse($petrolStationList);
}
开发者ID:robertlange81,项目名称:Website,代码行数:64,代码来源:soapserverRPC.php

示例8: Logging

<?php

/* Includes */
include 'engine/genericFTPEngine.php';
include 'adapters/genericProductsAdapter.php';
include 'core/logging.php';
/* turn off the maximum execution time */
ini_set('MAX_EXECUTION_TIME', -1);
/* file name construction preamble */
$priceFile = 'pricefile.xml';
$remotePriceFile = $priceFile . '.zip';
$localPriceFile = 'downloads/' . $priceFile;
/* instantiate logger */
$logger = new Logging();
$logger->lwrite('Integration Job at ' . date("Ymd") . ' BEGIN');
/* connect and fetch file logic */
$engine = new GenericFTPEngine($logger);
$engine->connect();
$engine->fetch($remotePriceFile, null);
$xml = $engine->load($localPriceFile);
$integration = new GenericProductsAdapter($logger);
$integration->process($xml);
/* clean up */
$logger->lwrite('Integration Job END');
$logger->lclose();
开发者ID:stjohnsenekal,项目名称:EAV-Example-with-FTP-Pricefile,代码行数:25,代码来源:genericProductsIntegration.php

示例9: getAllTowns

 public function getAllTowns()
 {
     require_once 'Logging.php';
     include 'db_connect.php';
     date_default_timezone_set('GMT');
     $query = "SELECT town_name, country from town ORDER BY town_name";
     $date = date('Y-m-d H:i:s');
     /* Create Log file */
     fopen("c:\nmpp\\htdocs\\weather\\automated\\log\\yahoo-api-download.txt", "w");
     // Logging class initialization
     $log = new Logging();
     // set path and name of log file (optional)
     $log->lfile('c:\\xampp\\htdocs\\weather\\automated\\log\\yahoo-api-download.txt');
     $log->lwrite('Script Started at: ' . $date);
     if ($result = $dbcon->query($query)) {
         /* fetch associative array */
         while ($row = $result->fetch_assoc()) {
             $town = $row['town_name'];
             $country = 'UK';
             echo $town . "\n";
             $query = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22" . rawurlencode($town) . "%2C%20" . $country . "%22)%20and%20u%20%3D%27c%27&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
             $weatherfeed = file_get_contents($query);
             $weatherfeed = json_decode($weatherfeed);
             if ($weatherfeed->query->results == null || $weatherfeed->query->results->channel->location->city == "United Kingdom") {
                 $weatherfeed = null;
                 // write message to the log file
                 $log->lwrite('API Fail for Town: ' . $row['town_name']);
             } else {
                 $request_date = new Datetime($weatherfeed->query->created);
                 $request_date = $request_date->format('Y-m-d H:i:s');
                 $fdate = new Datetime($weatherfeed->query->results->channel->item->forecast[0]->date);
                 $forecast_date = $fdate->format('Y-m-d');
                 $feed_url = $weatherfeed->query->results->channel->link;
                 $town = $weatherfeed->query->results->channel->location->city;
                 $postcode = null;
                 $min_temp = $weatherfeed->query->results->channel->item->forecast[0]->low;
                 $max_temp = $weatherfeed->query->results->channel->item->forecast[0]->high;
                 $avg_temp = $weatherfeed->query->results->channel->item->condition->temp;
                 $wind_dir = $weatherfeed->query->results->channel->wind->direction;
                 $conditions = $weatherfeed->query->results->channel->item->condition->text;
                 $source_id = 1;
                 $second_date = new Datetime($weatherfeed->query->results->channel->item->forecast[1]->date);
                 $second_date = $second_date->format('Y-m-d');
                 $second_mintemp = $weatherfeed->query->results->channel->item->forecast[1]->low;
                 $second_maxtemp = $weatherfeed->query->results->channel->item->forecast[1]->high;
                 $second_conditions = $weatherfeed->query->results->channel->item->forecast[1]->text;
                 $second_avg = $second_maxtemp / 2 + $second_mintemp / 2;
             }
             $presentforecast = "INSERT INTO weather_forecast (request_date, forecast_date, feed_url, town, postcode_prefix, min_temp, max_temp, avg_temp, wind_dir, conditions, source_id)\n\t\t\tVALUES ('{$request_date}', '{$forecast_date}', '{$feed_url}', '{$town}', '{$postcode}', '{$min_temp}', '{$max_temp}', '{$avg_temp}', '{$wind_dir}', '{$conditions}', '{$source_id}')";
             $secondforecast = "INSERT INTO weather_forecast (request_date, forecast_date, feed_url, town, postcode_prefix, min_temp, max_temp, avg_temp, wind_dir, conditions, source_id)\n\t\t\tVALUES ('{$request_date}', '{$second_date}', '{$feed_url}', '{$town}', '{$postcode}', '{$second_mintemp}', '{$second_maxtemp}', '{$second_avg}', null, 'second_conditions', '{$source_id}')";
             if ($dbcon->query($presentforecast) === TRUE) {
                 echo "New first created successfully \n";
                 if ($dbcon->query($secondforecast) === TRUE) {
                     echo "New second forecast created successfully \n\n";
                 } else {
                     echo "Error: \n" . $dbcon->error;
                 }
             } else {
                 echo "Error: \n" . $dbcon->error;
             }
         }
         $log->lwrite('Script Run on: ' . $date);
         // close log file
         $log->lclose();
         $dbcon->close();
     }
 }
开发者ID:jrk8,项目名称:infovis,代码行数:67,代码来源:Yahoo.php


注:本文中的Logging::lclose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。