Post and display data on webpage

Hello Everyone i hope u all will be in good health.
Actually i am doing a project in which i had to post data to a webpage from arduino .
I am still not able to send it properly on web and not able to display it

Here is my arduino code

Web client

This sketch connects to a website (
using an Arduino Wiznet Ethernet shield.


  • Ethernet shield attached to pins 10, 11, 12, 13

created 18 Dec 2009
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe, based on work by Adrian McEwen


#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// if you don’t want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
char server = “”; // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 1, 127);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {

// Open serial communications and wait for port to open:
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only

// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println(“Failed to configure Ethernet using DHCP”);
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip);
// give the Ethernet shield a second to initialize:
String message=“Hello”;
String data=“Message=”+message;
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
// Make a HTTP request:
client.println(“POST /arduino/data.php HTTP/1.1 200 OK”);
Serial.print(“POST /arduino/data.php HTTP/1.1 200 OK”);
//client.println(“HTTP/1.1 200 OK”);
// client.println(“User-Agent: Arduino/1.0”);
client.println(“Connection: close”);
client.print("Content-Length: ");
} else {
// if you didn’t get a connection to the server:
Serial.println(“connection failed”);

void loop() {
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c =;

// if the server’s disconnected, stop the client:
if (!client.connected()) {

// do nothing forevermore:
while (true);
in this code i am simply posting the hello message

here is php code

<?php $msg=$_POST['Message']; echo $msg; ?>

kindly response me as soon as possible
Waiting for your kind response

does your Ethernet shield have a SD card? if so you need to set the chip select as output and disable it

if your SD chip select is 4, then something like

  // disable SD SPI

have a look at the second part of this web client example for a well formed HTTP POST

ps: Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

This looks wrong:

char server[] = "";    // name address for Google (using DNS)

It should be a hostname ie without http://