Ethernet shield - get value online txt

Hello everybody,

I have to use an arduino controller with an internet shield to retrieve the value of a online text file, but the value is always display character per character .. I juste want to put the value in a constant but for me is not easy :confused:

Can you help me ?

Thanks a lot and bests regards

I juste want to put the value in a constant but for me is not easy

Well, it should be. Reading the server response, character by character, is not hard. Storing the data in an array is not hard. Parsing the stored data is not hard. Converting the token found to an int or a float is not hard.

You have some code that this functionality needs to be added to. Post that code, or do the work yourself.

Hi everybody,

thanks Paul for you repply,

i try this code ;

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char serverName[] = "www.la-referencerie.fr";
EthernetClient client;

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    while(true);
  }

  Serial.begin(9600);
}

void loop(){
      
      if (client.connect(serverName, 80)) {
        client.println("GET /unnicoin/unnicoin.txt HTTP/1.0");
        client.println("Host: www.la-referencerie.fr");
        client.println();
      } 
      else {
        Serial.println("connection failed");
        Serial.println();
      }
    
      while(client.connected() && !client.available()) delay(1); 
      while (client.connected() || client.available()){
        char data = client.read();
        Serial.print(data);

        
      }
      client.stop();
      
}

I have try too to put charactere by character in a array but how to define the lenght of array ? I have a true beginner in arduino can you give me some clue please …

Thank a lot and bests regards

char serverName[] = "www.la-referencerie.fr";

That's not a server name.

I have try too to put charactere by character in a array but how to define the lenght of array ?

You, and ONLY you, can see the server output. If the server is sending 5 to 10 characters, you have one problem. If the server is encoding the output in the contents of War and Peace, you have another problem.