You must assign a manual IP address to the laptop and Arduino.
Then include Ethernet.h in your sketch and try to make Ethernet connection. Finally you can see your webpage in your laptop by enter Arduino's IP in your browser. Example:
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x85, 0xD9 };
byte ip[] = { 192, 168, 1, 172 };
byte subnet[] = { 255, 255, 255, 0 };
byte gateway[] = { 192, 168, 1, 254 };
EthernetServer server(80);
void setup()
{
Ethernet.begin(mac,ip,gateway,subnet);
server.begin();
pinMode(8, INPUT);
}
void loop()
{
EthernetClient client = server.available();
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("<head>");
client.println("<title>Ethernet Tutorial</title>");
client.println("<meta http-equiv=\"refresh\" content=\"1\">");
client.println("</head>");
client.println("<body>");
client.println("<h1>A Webserver Tutorial </h1>");
client.println("<h2>Observing State Of Switch</h2>");
client.print("<h2>Switch is: </2>");
if (digitalRead(8))
{
client.println("<h3>ON</h3>");
}
else
{
client.println("<h3>OFF</h3>");
}
client.println("</body>");
client.println("</html>");
delay(1);
client.stop();
}