Display temperature sensor readings through wifi shield

Hi, I am new in the Arduino world. I am trying to print readings from a DS18B20 temperature sensor on web server. I am using a Mega 2560 and Arduino WiFi Shield. I cant print anything on the web server page but I am able to connect the WiFi network.
Can anyone please help me with this.

Thank you in advance for your guidance.

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

#define ONE_WIRE_BUS 2   // Data wire is plugged into port 2 on the Arduino


char ssid[] = "username";      //  your network SSID (name) 
char pass[] = "Network password";   // your network password
int keyIndex = 0;                 // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

WiFiServer server(80);

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
int tempC;


void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600); 
  Serial.println("starting data sending...");
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present"); 
    // don't continue:
    while(true);
  } 

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) { 
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:    
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  } 
  server.begin();
  // you're connected now, so print out the status:
  printWifiStatus();
  
  // start serial port
  Serial.begin(9600);

  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
}
void loop() {
  // listen for incoming clients
  WiFiClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connnection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");

          client.println("<meta http-equiv=\"refresh\" content=\"5\">");

          int digitalChannel = 0;

          client.print("Temperature in Celcius:");
          client.print(tempC);
          client.print("degrees C");

          client.print("
");
          client.println("</html>");

          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        } 
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
  // call sensors.requestTemperatures() to issue a global temperature 
  // request to all devices on the bus
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");

  tempC = sensors.getTempCByIndex(0);
  Serial.print("Device 1 (index0) =");
  Serial.print(tempC);
  Serial.print("Degrees C");
}
void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

Problem solved.
used the breakpoints to check where the code stops working.

used the breakpoints to check where the code stops working.

What breakpoints? Where did it stop?

Yes, please elaborate. I'd like to hear some hands-on debugging detail because I'm currently stuck. Do you mean actual software break points, with a debugger? Or just debugging print statements?

Sorry for the late reply, but i used print statements.
I am not sure why it wasn’t working before .
but this works fine.
I found some code online, so it has a refresh button on web page

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

#define ONE_WIRE_BUS 2   // Data wire is plugged into port 2 on the Arduino


char ssid[] = "User Name";      //  your network SSID (name) 
char pass[] = "Password";   // your network password
int keyIndex = 0;                 // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

WiFiServer server(80);





// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
float tempC;
float tempF;
float rssi;


void setup() {
  Serial.println("check point 1");
  //Initialize serial and wait for port to open:
  Serial.begin(9600); 
  Serial.println("starting data sending...");
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  Serial.println("check point 2");
  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present"); 
    // don't continue:
    while(true);
  } 
  Serial.println("check point 3");
  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) { 
    Serial.print("Attempting to connect to SSID: ");
    Serial.println("check point 4");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:    
    status = WiFi.begin(ssid, pass);
    Serial.println("check point 5");
    // wait 10 seconds for connection:
    delay(10000);

  } 
  Serial.println("check point 6");
  server.begin();
  // you're connected now, so print out the status:
  printWifiStatus();

  // start serial port

  Serial.println("check point 6");
  Serial.println("Dallas Temperature IC Control Library Demo");

  // Start up the library
  sensors.begin();
}
void loop() {
  // listen for incoming clients
  WiFiClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connnection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");

          client.println("<meta http-equiv=\"refresh\" content=\"25\">");

          int digitalChannel = 0;
       

          client.println(F("<td align=\"center\" valign=\"center\"><font size=\"12\" color=\"green\">&nbsp;&nbsp;****PUT YOUR HEADING HERE****&nbsp;&nbsp;</font></td>"));
          client.print("
");
          client.print("
");
          
          client.print(F("<font color=\"red\">"));
          client.print("IP Address of the Device:      ");
          client.print(WiFi.localIP());  // prints the ip address of the device

          client.print("
");
          
           client.print(F("<font color=\"red\">"));
           client.print("Signal Strength (RSSI):      ");   // prints the signal strength on the web server page
           client.print(WiFi.RSSI());
           client.println("   dBm");
            client.print("
");
          
          client.print(F("<font color=\"blue\">"));
          client.print("
");
          client.print("Temperature in Celsius:        ");

          client.print(tempC);
          client.print("    degrees C");

          client.print(F("<font color=\"blue\">"));
           client.print("
");
           client.print("Temperature in Fahrenheit:      ");
          client.print(tempF = tempC*1.8 + 32.00);     // converting Celsius to fahrenheit
          client.print("    Degrees F");

          client.print("
");
          client.println("</html>");
          
          // creates an HTML form with a refresh button that reloads the page with out any variables
          client.print("<FORM action=\"http://*****PUT the IP address where you want it to reload it to *****/\">");
          client.print("<P> <INPUT type=\"submit\" value=\"Refresh\"> </FORM>");
          client.print("<img src = 'https://api.cosm.com/v2/feeds/61098/datastreams/sensor1.png?width=500&height=250&colour=%230000cc&duration=1day&legend=Degrees%20Farenheit&title=Apartment%20Temperature&show_axis_labels=true&detailed_grid=true&scale=auto&timezone=UTC'>");
 
          

          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        } 
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
  // call sensors.requestTemperatures() to issue a global temperature 
  // request to all devices on the bus
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
   
   
   
  tempC = sensors.getTempCByIndex(0);
  Serial.print("Sensor is ONLINE");
  Serial.print("Device 1 (index0) =    ");
  Serial.print(tempC);
  Serial.print("    Degrees C");
}
void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address:   ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):      ");
  Serial.print(rssi);
  Serial.println("   dBm");

}