0

so i have this code

foreach ($listGame->response as $app) {
              $gameName = curl_init();
              curl_setopt($gameName, CURLOPT_URL, 'https://itunes.apple.com/lookup?id=' + $app->AppID);
              curl_setopt($gameName, CURLOPT_RETURNTRANSFER, TRUE);
              $gameNameRes = json_decode(curl_exec($gameName)) ;
              curl_close($gameName);
              $gameNameResults = $gameNameRes->results;

this is a loop, so there is a big API of apps, as this is a loop, what i want the code to do is,retrieve the app info from the appstore using the appID specified in the API. problem is, trying this code makes the site inaccessible, will not load, i dont know if this is because $listGame-response is indeed the API response from a cURL request i did earlier, maybe doing a cURL request and then looping through cURL requests is not the best idea, but i need to grab the info from the appstore from each app in the API

1 Answers1

0

The problem is, that you use + instead of . to add the get param to the url given to curl. Just replace + with . and the url should be correct

'https://itunes.apple.com/lookup?id=' . $app->AppID
Philipp
  • 15,377
  • 4
  • 35
  • 52