Downloading a webpage from the internet using Arduino via Ethernet Shield
Connections:
Just Connect Arduino Ethernet Shield on the top of Arduino or Arduino Mega, and connect Ethernet cable on which internet is accessible, and use the code given below to connect to the Internet using Arduino.
Code for Arduino:
In this program, we are downloading a test page from galaxysofts.com, which shows Date in two different formats.
#include <SPI.h> #include <Ethernet.h>byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 }; char serverName[] = "www.comm2excel.com"; EthernetClient client; void setup() { Serial.begin(9600); if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP"); while(true); } delay(1000); Serial.println("connecting..."); if (client.connect(serverName, 80)) { Serial.println("connected"); client.println("GET http://www.galaxysofts.com/uploads/test.php HTTP/1.0"); client.println(); } else { Serial.println("connection failed"); } } void loop() { if (client.available()) { char c = client.read(); Serial.print(c); } if (!client.connected()) { Serial.println(); Serial.println("disconnecting."); client.stop(); while(true); } }
Results:
Video on downloading a webpage from the internet (www) using Arduino via Ethernet Shield:
Downloads:
- Program: Arduino Code
* This code was earlier posted on comm2excel.com, which is closed and now we are transferring data to galaxysofts.com.
Related Links:
- Master RESET ESP8266 Wifi Module using Arduino mega 2560
- Changing Arduino Clock Frequency / Programming ATMEGA 8 directly from Arduino Software using USBasp
- Interfacing Soil Moisture Sensor with Arduino
- Fetching Google Search using MATLAB
- Interfacing SD Card with Arduino using SD Card Module
- Bluetooth HC-05, HC-06 Command/ Master Mode and AT Commands
- Reset Arduino using Programming
- Interfacing MPL3115A2 Altitude Sensor with Arduino UNO/ Mega
- Interfacing Water Flow Sensor with Arduino
- Interfacing GPS Shield for Arduino(ublox NEO-6M-0-001) with Arduino Mega 2560
- Increasing the length of Serial Buffer in Arduino
- Interfacing SIM900D GSM Module Board with Arduino Mega 2560
- Interfacing Bluetooth Modules HC-05, HC-06, JY-MCU BT_BOARD v1.02 and v1.03 with Arduino Uno and Arduino Mega 2560
- Getting feeds from ThingSpeak using ESP8266 and Arduino
- Errors in Simulating AVR ADC codes on Proteus
- Bluetooth Error Codes: