コード例 #1
0
//------------------------AllForwards------------------------------------
$result = $client->AllForwards(array("sCountryName" => ""));
$AllForwards = $result->AllForwardsResult->string;
foreach ($AllForwards as $k => $v) {
    $sql = "UPDATE player SET position='forward'WHERE player_name='{$v}'";
    mysqli_query($con, $sql);
}
//------------------------AllMidFields------------------------------------
$result = $client->AllMidFields(array("sCountryName" => ""));
$AllMidFields = $result->AllMidFieldsResult->string;
foreach ($AllMidFields as $k => $v) {
    $sql = "UPDATE player SET position='mid_field'WHERE player_name='{$v}'";
    mysqli_query($con, $sql);
}
//---------------------------TeamsCompeteList---------------------------------
$team = $client->TeamsCompeteList(array());
$teamresult = $team->TeamsCompeteListResult->tTeamCompete;
foreach ($teamresult as $k => $v) {
    $arr = $v->CoachInfo;
    $x = $arr->TeamInfo;
    $sql = "insert into team(team_id,team_name,Country_flag,Country_flag_Large,wikipedia_URL,coach,competed_count,won_count) values({$x->iId},'{$x->sName}','{$x->sCountryFlag}','{$x->sCountryFlagLarge}','{$x->sWikipediaURL}','{$arr->sName}',{$v->iCompeted},{$v->iWon})";
    if (!mysqli_query($con, $sql)) {
        echo mysqli_error($con);
        die(mysqli_error($con));
    }
}
//---------------------------GroupCompetitors-----------------------------------
$array = array("A", "B", "C", "D", "E", "F", "G", "H");
foreach ($array as $i => $value) {
    $result = $client->GroupCompetitors(array("sPoule" => "{$value}"));
    $GroupTeamsA = $result->GroupCompetitorsResult->tTeamInfo;