本文整理汇总了PHP中request::send方法的典型用法代码示例。如果您正苦于以下问题:PHP request::send方法的具体用法?PHP request::send怎么用?PHP request::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::send方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* @return array
*/
public function load()
{
$request = new request(self::steam_matches_url, $this->_get_data_array());
$xml = $request->send();
if (is_null($xml)) {
return null;
}
$matches = array();
if (isset($xml->matches)) {
$this->_total_results = $xml->total_results;
foreach ($xml->matches as $m_matches) {
foreach ($m_matches as $m) {
$match = new match();
$match->set_array((array) $m);
foreach ($m->players as $players) {
foreach ($players as $player) {
$slot = new slot();
$slot->set_array((array) $player);
$match->add_slot($slot);
}
}
$matches[$match->get('match_id')] = $match;
}
}
}
return $matches;
}
示例2: load
/**
* @return array
*/
public function load()
{
$request = new request(self::teams_steam_url, array('start_at_team_id' => $this->get_team_id(), 'teams_requested' => $this->get_teams_requested()));
$teams_info = $request->send();
if (is_null($teams_info)) {
return null;
}
$teams = array();
if (isset($teams_info->teams)) {
$teams_info = (array) $teams_info->teams;
$teams_info = $teams_info['team'];
foreach ($teams_info as $team_info) {
$team_info = (array) $team_info;
$team = new team();
$fields = array_keys($team_info);
foreach ($fields as $field) {
// I hope, that API-response will be changed and players_ids, leagues_ids will become arrays
if (preg_match('/^player_\\d+_account_id$/', $field)) {
$team->add_player_id($team_info[$field]);
continue;
}
if (preg_match('/^league_id_\\d+$/', $field)) {
$team->add_league_id($team_info[$field]);
continue;
}
$team->set($field, (string) $team_info[$field]);
}
$teams[$team->get('team_id')] = $team;
}
return $teams;
}
}
示例3: load
/**
* @param int $ugcid
* @return object | null
*/
public function load($ugcid = null)
{
if (!is_null($ugcid)) {
$this->_ugcid = $ugcid;
}
$request = new request(self::steam_ugc_url, array('appid' => 570, 'ugcid' => $this->_ugcid));
return $request->send();
}
示例4: load
public function load()
{
$request = new request(self::leagues_prize_pool_steam_url, array('leagueid' => $this->get_league_id()));
$prize_pool = $request->send();
if (is_null($prize_pool)) {
return null;
}
return (array) $prize_pool;
}
示例5: load
/**
* Load match info by match_id
*/
public function load()
{
$request = new request(self::steam_match_url, array('match_id' => $this->get_match_id()));
$match_info = $request->send();
if (is_null($match_info)) {
return null;
}
$match = new match();
$players = array();
foreach ($match_info->players->player as $key => $player) {
$players[] = $player;
}
$data = (array) $match_info;
unset($data['players']);
$data['start_time'] = date('Y-m-d H:i:s', $data['start_time']);
$data['radiant_win'] = $data['radiant_win'] == 'true' ? '1' : '0';
$match->set_array($data);
// slots info
foreach ($players as $player) {
$data = (array) $player;
$data['match_id'] = $this->get_match_id();
$slot = new slot();
$slot->set_array($data);
// additional_units
if (isset($data['additional_units'])) {
$slot->set_additional_unit_items((array) $data['additional_units']->unit);
}
// abilities
if (isset($data['ability_upgrades'])) {
$d = (array) $data['ability_upgrades'];
$abilities_upgrade = $d['ability'];
if (!is_array($abilities_upgrade)) {
$abilities_upgrade = array($abilities_upgrade);
}
foreach ($abilities_upgrade as $k => $v) {
$abilities_upgrade[$k] = (array) $abilities_upgrade[$k];
}
$slot->set_abilities_upgrade($abilities_upgrade);
}
$match->add_slot($slot);
}
if (isset($match_info->picks_bans)) {
$picks_bans = (array) $match_info->picks_bans;
foreach ($picks_bans['pick_ban'] as $k => $v) {
$picks_bans['pick_ban'][$k] = (array) $v;
if ($picks_bans['pick_ban'][$k]['is_pick'] == 'false') {
$picks_bans['pick_ban'][$k]['is_pick'] = '0';
} else {
$picks_bans['pick_ban'][$k]['is_pick'] = '1';
}
}
$match->set_all_pick_bans($picks_bans['pick_ban']);
}
return $match;
}
示例6: load
/**
* Load match info by match_id
*/
public function load()
{
$request = new request(self::STEAM_MATCH_URL, array('match_id' => $this->getMatchId()));
$matchInfo = $request->send();
if (null === $matchInfo) {
return null;
}
$match = new Match();
$players = array();
foreach ($matchInfo->players->player as $key => $player) {
$players[] = $player;
}
$data = (array) $matchInfo;
unset($data['players']);
$data['start_time'] = date('Y-m-d H:i:s', $data['start_time']);
$data['radiant_win'] = $data['radiant_win'] === 'true' ? '1' : '0';
$match->setArray($data);
// slots info
foreach ($players as $player) {
$data = (array) $player;
$data['match_id'] = $this->getMatchId();
$slot = new Slot();
$slot->setArray($data);
// additional_units
if (array_key_exists('additional_units', $data)) {
$slot->setAdditionalUnitItems((array) $data['additional_units']->unit);
}
// abilities
if (array_key_exists('ability_upgrades', $data)) {
$d = (array) $data['ability_upgrades'];
$abilitiesUpgrade = $d['ability'];
if (!is_array($abilitiesUpgrade)) {
$abilitiesUpgrade = array($abilitiesUpgrade);
}
foreach ($abilitiesUpgrade as $k => $v) {
$abilitiesUpgrade[$k] = (array) $abilitiesUpgrade[$k];
}
$slot->setAbilitiesUpgrade($abilitiesUpgrade);
}
$match->addSlot($slot);
}
if (isset($matchInfo->picks_bans)) {
$picksBans = (array) $matchInfo->picks_bans;
foreach ($picksBans['pick_ban'] as $k => $v) {
$picksBans['pick_ban'][$k] = (array) $v;
$picksBans['pick_ban'][$k]['is_pick'] = filter_var($picksBans['pick_ban'][$k]['is_pick'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
}
$match->setAllPickBans($picksBans['pick_ban']);
}
return $match;
}
示例7: load
/**
* @return array
*/
public function load()
{
$request = new request(self::heroes_steam_url, array());
$response = $request->send();
if (is_null($response)) {
return null;
}
$heroes_info = (array) $response->heroes;
$heroes_info = $heroes_info['hero'];
$heroes = array();
foreach ($heroes_info as $hero_info) {
$info = (array) $hero_info;
$heroes[$info['id']] = $info;
}
return $heroes;
}
示例8: load
/**
*
*/
public function load()
{
$request = new request(self::league_steam_url, array('league_id' => $this->get_league_id()));
$league_live_matches = $request->send();
if (is_null($league_live_matches)) {
return null;
}
$league_live_matches = $league_live_matches->games;
$live_matches = array();
if (!isset($league_live_matches->game)) {
return array();
}
foreach ($league_live_matches->game as $game) {
$live_match = new live_match();
foreach ($game->players->player as $player) {
switch ($player->team) {
case 0:
$live_match->add_radiant_player((array) $player);
break;
case 1:
$live_match->add_dire_player((array) $player);
break;
case 2:
$live_match->add_broadcaster((array) $player);
break;
case 4:
$live_match->add_unassigned((array) $player);
break;
}
}
$a_game = (array) $game;
unset($a_game['players']);
$a_game['radiant_team_id'] = (string) $a_game['radiant_team']->team_id;
$a_game['radiant_name'] = (string) $a_game['radiant_team']->team_name;
$a_game['radiant_logo'] = (string) $a_game['radiant_team']->team_logo;
$a_game['radiant_team_complete'] = $a_game['radiant_team']->complete == 'false' ? 0 : 1;
$a_game['dire_team_id'] = (string) $a_game['dire_team']->team_id;
$a_game['dire_name'] = (string) $a_game['dire_team']->team_name;
$a_game['dire_logo'] = (string) $a_game['dire_team']->team_logo;
$a_game['dire_team_complete'] = $a_game['dire_team']->complete == 'false' ? 0 : 1;
unset($a_game['dire_team']);
unset($a_game['radiant_team']);
$live_match->set_array($a_game);
array_push($live_matches, $live_match);
}
return $live_matches;
}
示例9: load
/**
* @return array
*/
public function load()
{
$request = new request(self::items_steam_url, array());
$response = $request->send();
if (is_null($response)) {
return null;
}
$items_info = (array) $response->items;
$items_info = $items_info['item'];
$items = array();
foreach ($items_info as $item_info) {
$info = (array) $item_info;
array_walk($info, function (&$v) {
$v = (string) $v;
});
$item = new item();
$item->set_array($info);
$items[$info['id']] = $item;
}
return $items;
}
示例10: load
/**
* @return array
*/
public function load()
{
$request = new request(self::leagues_steam_url, array());
$response = $request->send();
if (is_null($response)) {
return null;
}
$leagues_info = (array) $response->leagues;
$leagues_info = $leagues_info['league'];
$leagues = array();
foreach ($leagues_info as $league_info) {
$info = (array) $league_info;
array_walk($info, function (&$v) {
$v = (string) $v;
});
$league = new league();
$league->set_array($info);
$leagues[$info['leagueid']] = $league;
}
return $leagues;
}
示例11: load
/**
* @return array
*/
public function load()
{
$request = new request(self::player_steam_url, array('steamids' => $this->get_ids_string()));
$players_info = $request->send();
if (is_null($players_info)) {
return null;
}
$players = array();
foreach ($players_info->players[0] as $player_info) {
$player = new player();
$player->set_array((array) $player_info);
$players[$player->get('steamid')] = $player;
}
return $players;
}