Retrieving data from web using arduino ethernet

I am new to arduino coding. However, I need to send and retrieve my data (words and number) to the web using arduino ethernet. Currently, I am able to send my data using the webserver code. I am not sure if from the receive side, I should use the webclient code. I also have the problem of getting the data since webclient code (from my understanding) is connected to the website which in my case, have to connect to my "send side" ip address web. Or is there other code which is appropriate for such function. I understand that twitterclient code is able to get the data but, I am not sure on how it is being used.

Thanks in advance for your time and help.

I try using the Webclient code for my receiving side but I am not sure which statement should I change to connect to the IP address of my 1st Ethernet shield and be able to read the value on that address. I try altering the chatserver and host but, it was soon disconnected.

Thanks for your help.

/*
Web client

This sketch connects to a website (http://www.google.com)
using an Arduino Wiznet Ethernet shield.

Circuit:

  • 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 = { 0x90, 0xA2, 0xDA, 0x0F, 0x59, 0x78 };
// 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(192,168,1,10);
char server = “www.youtube.com”; // name address for Google (using DNS)

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

// 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:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println(“Failed to configure Ethernet using DHCP”);
// no point in carrying on, so do nothing forevermore:
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip);
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println(“connecting…”);

// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println(“connected”);
// Make a HTTP request:
client.println(“GET /search?q=arduino HTTP/1.1”);
client.println(“Host: www.youtube.com”);
client.println(“Connection: close”);
client.println();
}
else {
// kf 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 = client.read();
Serial.print(c);
//A mode command is specified with the word mode
if (c == ‘Yeo’)
{
Serial.print(“Yes”);
}

}

// if the server’s disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println(“disconnecting.”);
client.stop();

// do nothing forevermore:
while(true);
}
}

However, I need to send and retrieve my data (words and number) to the web using arduino ethernet.

You don't seem to understand about client (browser)/server architecture.

The Arduino can be a server, providing responses to clients. The Arduino can be a client, getting data from a server.

"Retrieving data to the web" using an Arduino does not make sense.

I am not sure if from the receive side, I should use the webclient code.

Is the "receive side" an Arduino? If so, yes. If not, no.

I also have the problem of getting the data since webclient code (from my understanding) is connected to the website which in my case, have to connect to my "send side" ip address web.

Forget about "the website". A server provides data. A client consumes data (possibly be rendering an image, if the client is a browser). A "website" is a script that generates dynamic data or a static page of data.

I try using the Webclient code for my receiving side but I am not sure which statement should I change to connect to the IP address of my 1st Ethernet shield

One of these needs to change. The other needs to be commented out.

//IPAddress server(192,168,1,10);
char server[] = "www.youtube.com";    // name address for Google (using DNS)

I try altering the chatserver and host but, it was soon disconnected.

I tried making a banana pie from some other fruit. But, it didn't taste like a banana pie. What did it taste like?

How are we supposed to provide help when you do not describe what you changed, why you changed it, and what actually happened?