次の関数にすべての競技IDを保存しようとしています:
function getSoccerByCountry($appKey, $sessionToken, $country, $competitionid)
{
$jsonResponse = sportsApingRequest($appKey, $sessionToken, 'listMarketCatalogue', '{"filter":{
"eventTypeIds": [
"1"
],"competitionIds":["' . $competitionid . '"],"marketTypeCodes":["MATCH_ODDS"],"marketCountries":["' . $country . '"],"inPlayOnly": true
},
"maxResults": "200",
"marketProjection": [
"COMPETITION",
"EVENT",
"EVENT_TYPE",
"RUNNER_DESCRIPTION",
"RUNNER_METADATA",
"MARKET_START_TIME"
]
},
"id": 1}
]');
配列のすべてのキー値をループし、getSoccerByCountry 関数に渡される競技 ID のみを取得するループごとにこれを作成しました。
foreach ($getSoccerComp as $key1)
{
$getSoccerCountry = getSoccerByCountry($appKey, $sessionToken, $countrycode, $key1->competition->id);
}
すべての競技 ID は完全な整数として渡されますが、コンマで区切られて渡されるようにしたいと思います。