curl API return invalid_grant

Hi, everyone .

I want to get email id with sugarAPI in the logic hook function.

There are two more people in the array , so I used for loop to call the API

      $id=array($i);//user id in array
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_GET,1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//
$output = curl_exec($ch);

It works if there is only one in array . after number one it will return

{"error":"invalid_grant","error_message":"The access token provided is invalid."}

So I get a new access_token every time in the for loop , but it didn't work .

Still get "error":"invalid_grant" ...


Thanks for watching and helping.