before this I try to make the same think using this scheme:
but for some reason it didn't work
Yeah, this thing is only useful for very short distances, like under 1/2" [12mm].
That little cutout indicates you took this image from a photointerruptor datasheet.
See what it says about usable range.
Also, the devices that use IR Leds for illumination and 38-Khz TV remote detectors
for pickup are usually called IRPDs [IR proximity detectors] and their effective range
is usually about 18-24" max.
Besides what the others mentioned, if this only needs to work in the light and the
distances don't need to be too great, one possible thing to try is a simple LDR [light
dependent resistor]. Hook up as a voltage divider, and place a tube around the cell in
order to get some directionality.
Then, you constantly sample the output to track the ambient light levels, and look
only for quick changes in response from ambient, indicative of someone walking on
the field-of-view. Slow ambient lighting changes will be subtracted out.