I have problem to connect temperatur sensor dht11 and dht22 to a digital input and read it
Digital inputs only read on/off values such as the status of a switch.
A temperature sensor has either an analog outputs (a voltage that varies) or a digital output (a series of 0 and 1 transitions, which follow a certain protocol).
Analog values cannot be read via a digital input.
A digital protocol can be read if you write the necessary routines which capture the bit stream.