The connection isn't shown, the hostname should NOT be "localhost" since you don't wish ESP to connect to itself but to PHP serve with it IP, the "get" should not contain hostname when sending the request, it should only contain path and arguments as :
String req = "/food/conec.php?temperatura="+String(t)+"&wilgotnosc="+String(h);
For more details, look at the WiFiClient example : https://github.com/esp8266/Arduino/blob ... Client.ino
For doing queries instead of data push, simple to something like "/food/conec.php?cmd=querydata" and on PHP side, return a JSON results, the ESP receving that can parse it and to something with the data.