esp8266 thing dev to thingspeak problem

i am using a sparkfun esp8266 thing dev board to read some d1820b sensors, access my home network and post results to thingspeak. this used to work, but i admit i had not checked on it for a long time. It seems something changed last februrary and onewire was updated. researching this issue, i found i needed to update the onewire library, which i did, also deleting the original onewire library .
now it won't compile.
although i have been experimenting with things, i believe this is the original code that originally worked.
i have written some code of my own from scratch but have little experience. as you can see from notes i made in the code i copied this code from another source. i posted my error message below the code
i am a little bit over my head trying to figure out what changed and what i need to do. thanks.

//FROM http://internetofthinking.blogspot.com/2016/02/upload-ds18b20-temperature-sensor-data.html
//FROM https://www.instructables.com/id/ESP8266-Wifi-Temperature-Logger/

#include <DallasTemperature.h>
#include <OneWire.h>

#define myPeriodic 15 //in sec | Thingspeak pub is 15sec
#define ONE_WIRE_BUS 2  // DS18B20 on arduino pin2 corresponds to D4 on physical board

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float prevTemp = 0;
const char* server = "api.thingspeak.com";
String apiKey ="L6US8O0HL202M9LD";
const char* MY_SSID = "netgear31"; 
const char* MY_PWD = "festiveteapot473";
int sent = 0;
void setup() {
  Serial.begin(115200);
  connectWifi();
}

void loop() {
  float temp;
  //char buffer[10];
  DS18B20.requestTemperatures(); 
  temp = DS18B20.getTempFByIndex(0);
  //String tempF = dtostrf(temp, 4, 1, buffer);//handled in sendTemp()
  Serial.print(String(sent)+" Temperature: ");
  Serial.println(temp);
  
  if (temp != prevTemp)
  {
  sendTemperatureTS(temp);
  prevTemp = temp;
  }
  
  sendTemperatureTS(temp);
  int count = myPeriodic;
  while(count--)
  delay(1000);
}

void connectWifi()
{
  Serial.print("Connecting to "+*MY_SSID);
  WiFi.begin(MY_SSID, MY_PWD);
  while (WiFi.status() != WL_CONNECTED) {
  delay(1000);
  Serial.print(".");
  }
  
  Serial.println("");
  Serial.println("Connected");
  Serial.println("");  
}//end connect

void sendTemperatureTS(float temp)
{  
   WiFiClient client;
  
   if (client.connect(server, 80)) { // use ip 184.106.153.149 or api.thingspeak.com
   Serial.println("WiFi Client connected ");
   
   String postStr = "apiKey";
   postStr += "field1=";
   postStr += String(temp);
   postStr += "\r\n\r\n";
   
   client.println("POST /update HTTP/1.1\n");
   client.println("Host: api.thingspeak.com\n");
   client.println("Connection: close\n");
   client.println("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
   client.println("Content-Type: application/x-www-form-urlencoded\n");
   client.println("Content-Length:");
   client.println(postStr.length());
   client.println("\n\n");
   client.println(postStr);
   delay(1000);
        
  }
  else {
    Serial.println("Failure: Failed to connect to ThingSpeak");
  }
  delay(250); //Wait to receive the response
  client.parseFloat();
  String resp = String(client.parseInt());
  Serial.println("Response code:"+resp); // Print the response code. 202 indicates that the server has accepted the response
    }//end if
//   sent++;
// client.stop();
//end send

Arduino: 1.8.13 (Windows 8.1), Board: "SparkFun ESP8266 Thing Dev, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 512KB (FS:32KB OTA:~230KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

error message:
Arduino: 1.8.13 (Windows 8.1), Board: "SparkFun ESP8266 Thing Dev, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 512KB (FS:32KB OTA:~230KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

D:\arduino sketches backup\Successful_temp_post_to_thingspeak\Successful_temp_post_to_thingspeak.ino: In function 'void connectWifi()':

Successful_temp_post_to_thingspeak:48:3: error: 'WiFi' was not declared in this scope

WiFi.begin(MY_SSID, MY_PWD);

^

Successful_temp_post_to_thingspeak:49:27: error: 'WL_CONNECTED' was not declared in this scope

while (WiFi.status() != WL_CONNECTED) {

^

D:\arduino sketches backup\Successful_temp_post_to_thingspeak\Successful_temp_post_to_thingspeak.ino: In function 'void sendTemperatureTS(float)':

Successful_temp_post_to_thingspeak:61:4: error: 'WiFiClient' was not declared in this scope

WiFiClient client;

^

Successful_temp_post_to_thingspeak:61:15: error: expected ';' before 'client'

WiFiClient client;

^

Successful_temp_post_to_thingspeak:63:8: error: 'client' was not declared in this scope

if (client.connect(server, 80)) { // use ip 184.106.153.149 or api.thingspeak.com

^

Successful_temp_post_to_thingspeak:87:3: error: 'client' was not declared in this scope

client.parseFloat();

^

exit status 1

'WiFi' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Your code only inlcudes onewire and dallastemperature

For connecting to a router and thingspeak you also need to include

#include "ThingSpeak.h"
#include <ESP8266WiFi.h>

I suggest you roll back to a working example-code that does successfully send data to thingspeak and work up from there

best regards Stefan

thanks. at least it has compiled. just so i understand what happened, did things change at thingspeak that now required use of updated onewire and an additional library (thingspeak). i wasn't using that library before and it worked just fine.

to add knowledge:
in c++ programs are divided in functional parts.
If you want to use a certain functionality that goes beyond standard stuff like
digitalWrite, digitalRead etc.

these functionalities are stored in two seperated files
with the example Wif-fucntionality for the ESP8266 these are the files
ESP8266WiFi.h
and
ESP8266WiFi.cpp.

For incorporating the functionality it is enough to include the *.h-file
the header-file. WHich has the "Interfacing definitions.

The real stuff is inside the ESP8266WiFi.cpp-file

So without including the ESP8266WiFi.h-file
the compiler has no definitions for all the commands inside the
ESP8266WiFi.h and ESP8266WiFi.cpp-files

and then the compiler complaining
"'WiFi' was not declared in this scope"
because of the missing include-file

best regards Stefan

I am 101% sure that connecting to a WLAN-router requires in every single case including
ESP8266WiFi.h

and sending data to thingspeak requieres in every single case including
"ThingSpeak.h

maybe when using http put get etc. the includefile thingspeak maybe not nescessary
but the ESP8266WiFi.h in every case

it may be that it was hidden in some other files but again I am 150% sure that they were there.
The only possability to not having to use the include-lines
would be that somebody did put all the code from the includefile into the main-file
this would work too but why should do something like this?

if you still have the old file where you claim you did not need the include-files
can you post them?

best regards Stefan

i did go back and try to see how i built that sketch. for sure, at least the esp8266wifi.h was in the sketch that worked. so now i am at least 100% sure you are right. i must have deleted those lines and forgot what i did. on a good note, i also learned i should document what i did a little better! thanks alot for the help