MKR100 stalls

Maybe printing some info when a connection attempt fails will help to narrow it down

  if (client.connect(server, 80)) {
    Serial.print("connected to server: ");
    Serial.println (millis());
    ...
    ...
  }
  else
  {
    Serial.print("failed to connect to server: ");
    Serial.println (millis());
  }

I've modified your original println slightly to add a 'time' and added the else block. Maybe you can correlate your dropouts.

Looking at your code, the dropout might also be caused by a failure to read the sensor. But that should show on the serial monitor (or whatever you use).

Note that you need to keep your computer running with the serial monitor (or similar) application so you can view the results.

If you can't monitor the screen the whole time, you will need to find an alternative to serial monitor that can log to file. I think e.g. putty and realterm (and there will be others) can do so.

Note:
no experience with MKR1000 nor with WiFi nor with DHT