本文整理汇总了PHP中Feed::getKills方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::getKills方法的具体用法?PHP Feed::getKills怎么用?PHP Feed::getKills使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feed
的用法示例。
在下文中一共展示了Feed::getKills方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
Util::scrapeCheck();
$parameters = Util::convertUriToParameters();
// Enforcement
if (sizeof($parameters) < 2) {
die("Invalid request. Must provide at least two request parameters");
}
// At least one of these modifiers is required
$requiredM = array("characterID", "corporationID", "allianceID", "factionID", "shipTypeID", "groupID", "solarSystemID", "regionID", "solo", "w-space");
$hasRequired = false;
foreach ($requiredM as $required) {
$hasRequired |= array_key_exists($required, $parameters);
}
if (!isset($parameters["killID"]) && !$hasRequired) {
throw new Exception("Must pass at least two required modifier. Please read API Information.");
}
$return = Feed::getKills($parameters);
$array = array();
foreach ($return as $json) {
$array[] = json_decode($json, true);
}
$app->etag(md5(serialize($return)));
$app->expires("+1 hour");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
if (isset($parameters["xml"])) {
$app->contentType("text/xml; charset=utf-8");
echo Util::xmlOut($array, $parameters);
} elseif (isset($_GET["callback"]) && Util::isValidCallback($_GET["callback"])) {
$app->contentType("application/javascript; charset=utf-8");
header("X-JSONP: true");
echo $_GET["callback"] . "(" . json_encode($array, JSON_NUMERIC_CHECK) . ")";
示例2: array
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//make sure the requester is not being a naughty boy
Util::scrapeCheck();
//set the headers to cache the request properly
$dna = array();
$parameters = Util::convertUriToParameters();
$page = 1;
if (isset($parameters["page"])) {
$page = $parameters["page"];
}
$kills = Feed::getKills(array("limit" => 200, "cacheTime" => 3600, "page" => $page));
foreach ($kills as $kill) {
$kill = json_decode($kill, true);
$killdata = Kills::getKillDetails($kill["killID"]);
$dna[][] = array("killtime" => $killdata["info"]["dttm"], "SolarSystemName" => $killdata["info"]["solarSystemName"], "solarSystemID" => $killdata["info"]["solarSystemID"], "regionID" => $killdata["info"]["regionID"], "regionName" => $killdata["info"]["regionName"], "victimCharacterID" => isset($killdata["victim"]["characterID"]) ? isset($killdata["victim"]["characterID"]) : null, "victimCharacterName" => isset($killdata["victim"]["characterName"]) ? isset($killdata["victim"]["characterName"]) : null, "victimCorporationID" => isset($killdata["victim"]["corporationID"]) ? isset($killdata["victim"]["corporationID"]) : null, "victimCorporationName" => isset($killdata["victim"]["corporationName"]) ? isset($killdata["victim"]["corporationName"]) : null, "victimAllianceID" => isset($killdata["victim"]["allianceID"]) ? isset($killdata["victim"]["allianceID"]) : null, "victimAllianceName" => isset($killdata["victim"]["allianceName"]) ? isset($killdata["victim"]["allianceName"]) : null, "victimFactionID" => isset($killdata["victim"]["factionID"]) ? isset($killdata["victim"]["factionID"]) : null, "victimFactionName" => isset($killdata["victim"]["factionName"]) ? isset($killdata["victim"]["factionName"]) : null, "dna" => Fitting::DNA($killdata["items"], $killdata["victim"]["shipTypeID"]));
}
$app->etag(md5(serialize($dna)));
$app->expires("+1 hour");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");
$app->contentType("application/json; charset=utf-8");
echo json_encode($dna, JSON_NUMERIC_CHECK);
示例3: array
<?php
//set the headers to cache the request properly
$dna = array();
$parameters = Util::convertUriToParameters();
$page = 1;
if (isset($parameters['page'])) {
$page = $parameters['page'];
}
$kills = Feed::getKills(array('limit' => 200, 'cacheTime' => 3600, 'page' => $page));
foreach ($kills as $kill) {
$kill = json_decode($kill, true);
$killdata = Kills::getKillDetails($kill['killID']);
$dna[][] = array('killtime' => $killdata['info']['dttm'], 'SolarSystemName' => $killdata['info']['solarSystemName'], 'solarSystemID' => $killdata['info']['solarSystemID'], 'regionID' => $killdata['info']['regionID'], 'regionName' => $killdata['info']['regionName'], 'victimCharacterID' => isset($killdata['victim']['characterID']) ? isset($killdata['victim']['characterID']) : null, 'victimCharacterName' => isset($killdata['victim']['characterName']) ? isset($killdata['victim']['characterName']) : null, 'victimCorporationID' => isset($killdata['victim']['corporationID']) ? isset($killdata['victim']['corporationID']) : null, 'victimCorporationName' => isset($killdata['victim']['corporationName']) ? isset($killdata['victim']['corporationName']) : null, 'victimAllianceID' => isset($killdata['victim']['allianceID']) ? isset($killdata['victim']['allianceID']) : null, 'victimAllianceName' => isset($killdata['victim']['allianceName']) ? isset($killdata['victim']['allianceName']) : null, 'victimFactionID' => isset($killdata['victim']['factionID']) ? isset($killdata['victim']['factionID']) : null, 'victimFactionName' => isset($killdata['victim']['factionName']) ? isset($killdata['victim']['factionName']) : null, 'dna' => Fitting::DNA($killdata['items'], $killdata['victim']['shipTypeID']));
}
$app->etag(md5(serialize($dna)));
$app->expires('+1 hour');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET');
$app->contentType('application/json; charset=utf-8');
echo json_encode($dna, JSON_NUMERIC_CHECK);