env('SENDGRID_USERNAME'), 'api_key' => env('SENDGRID_PASSWORD'), 'date' => 1, 'days' => 7 ]; $fullURL = $URL . '?' . http_build_query($parameters); $data = json_decode(file_get_contents($fullURL)); var_dump($data); /* * Loop the result, if any. */ if (is_array($data)) { foreach ($data as $entry) { $address = $entry->email; $user = User::where('email', $address)->first(); if (!is_null($user)) { $user->blocked = 1; $user->password = 'bounced'; $user->save(); } } } } }