I fail to understand why you think WiFi.h library should work with esp8266.
It works with Arduino WiFi Shield
As far as I know ESP 01 is not Arduino WiFi shield, maybe I am wrong?
Edit: That is not your biggest problem though.
I fail to understand why you think WiFi.h library should work with esp8266.
It works with Arduino WiFi Shield
As far as I know ESP 01 is not Arduino WiFi shield, maybe I am wrong?
Edit: That is not your biggest problem though.