I am trying to store every competition id in the following function:
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}
]');
I have created this for each loop which loops every key value of the array and gets only the competition id which is being passed to the getSoccerByCountry function.
foreach ($getSoccerComp as $key1)
{
$getSoccerCountry = getSoccerByCountry($appKey, $sessionToken, $countrycode, $key1->competition->id);
}
Although, all the competition ids are passing as a whole integer, I want them to pass separated with a comma.
Something like this?
foreach ($getSoccerComp as $key1){
$ids[] = $key1->competition->id;
}
getSoccerByCountry($appKey, $sessionToken, $countrycode, implode(',', $ids));
Sinse you weren't doing anything with $getSoccerCountry
except rewriting the variable over and over again with value null
I removed the obselete code.