Getting HTML code from a website

Hello,

what is command that help to get HTML code from specific website

Thx

saleemnabaki:
Hello,

what is command that help to get HTML code from specific website

Thx

What do you mean by 'get HTML code'?

I want to get ( HTML CODE ) that belong to specific URL and reserve it in Arduino's memory in order to deal with some values

Hi

Page source code?

In Firefox it's control-U.

To copy it use control-A, Control-C then paste it to a notepad file, etc.

For other browsers you can do a quick google search.

Peter

:o i'm talking about Arduino's commands

saleemnabaki:
I want to get ( HTML CODE ) that belong to specific URL and reserve it in Arduino's memory in order to deal with some values

saleemnabaki:
:o i'm talking about Arduino's commands

Do you mean copy a line or paragraph of code then upload it to an Arduino board?...
If so, you can just copy the code and paste in the Arduino software then upload it to the board.

Take a look at the WebClient example that comes with whichever networking library you’re using.

For example, if you were using the WiFiNINA library, the WiFiWebClient example shows you how to get the HTML of a Google search page:

There’s one value in HTML i’m interested . and this value will change in the future so i want build my project to watch this value and make connect pins to led to alert me when value change.
So I want to load HTML and reserve it in Arduino’s memory in order to deal with this value

sounds like web scraping,

not sufficient for Arduino to handle HTML's payload size

ESP8266 should be a way to go

Yes pert thanx for sharing but unfortunately does't work with ESP family !!! by the way same code i'm using with esp8266 but results came back with HTTP code ,,,,,, not HTML .

It sound like you are doing this all wrong, it is very rare to phrase HTML code directly, especially with a micro controller that has limited memory. Then again a ESP is capable of doing this but what if the HTML structure changes or you get a corrupt value ?

You questions and statements are misleading, but if you want my two cents and experience you should create a web service in PHP that will echo the values you require, thus you then only need to connect to the web service URL and read the response, simple…

KASSIMSAMJI:
not sufficient for Arduino to handle HTML's payload size

I guess by "Arduino" you mean AVR? If the AVR boards don't meet your needs, there are more capable Arduino boards. The SAMD boards have 32 kB of SRAM. The Nano 33 BLE boards have 256 kB of SRAM.

saleemnabaki:
Yes pert thanx for sharing but unfortunately does't work with ESP family !!! by the way same code i'm using with esp8266 but results came back with HTTP code ,,,,,, not HTML .

Sounds like an XY problem. If you'll take the time to provide all the relevant information, I'm certain you'll get a solution quickly.

Or you can continue to be vague and see how long people want to play guessing games with you before losing interest and moving on to more productive threads.

KASSIMSAMJI Can I read a specific line from HTML CODE to find target word in this line to compare it with othoer word?

The first thing you need to do is manage to get the HTML. Once you have done that, you can start thinking about parsing it.

KawasakiZx10r I agree with you that possible the structure change in the future but theres one word on the website will not change .And I'm building my project on that that i want watch this word if change it i will get alarm

pert Certainly ... after getting the file and putting it in memory to search for the value that I want .. the rest will become easy

OK, so why don't we work on that. Please provide a detailed description of what you have tried and what the results were. We'll need your full sketch.

How one gets HTML depends upon what library one is using which depends upon what hardware you're using which you haven't described. It would also be helpful if you gave details on the website you plan on getting the data from because the webpage size drives the amount of memory required on the processor.

“Can I read a specific line from HTML CODE to find target word in this line to compare it with othoer word?”

At one time there was an application called something like “textfinder” that would look for things in character streams. You might use the forum search for it the upper right to look for it. If you know the line in the html file that has your info and the html does not change, you can count the line feeds as the file is downloaded and capture the desired line for evaluation. The below shows how it might work.

//zoomkat 12-22-10
//simple ethernet client test code
//for use with IDE 0021 and W5100 ethernet shield
//modify the arduino lan ip address as needed
//open serial monitor to see what the arduino receives
//push the shield reset button to run client again

#include <SPI.h>
#include <Ethernet.h>
String readString, readString1;
int x=0;
char lf=10;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//byte ip[] = { 192, 168, 1, 102 };
//byte server[] = { 140, 90, 238, 27 }; // NOAA
char serverName[] = "www.ndbc.noaa.gov";

EthernetClient client;

void setup()
{
  Ethernet.begin(mac);
  Serial.begin(9600);
  Serial.println("starting simple arduino client test");
  Serial.println();
  Serial.println("connecting...");

  if (client.connect(serverName, 80)) {
    Serial.println("connected");
    client.println("GET /data/5day2/44013_5day.txt HTTP/1.1");
    client.println("Host: www.ndbc.noaa.gov");
    client.println("Connection: close"); 
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    //Serial.print(c);  // uncomment to see raw feed
    if (c==lf) x=(x+1);
    if (x==14) readString += c;
    //readString += c;
  }

  if (!client.connected()) {
     client.stop();

    Serial.println("Current data row:" );
    Serial.print(readString);
    Serial.println();
    readString1 = (readString.substring(41,43));
    Serial.println();
    Serial.print("DPD sec: ");
    Serial.println(readString1);
    Serial.println("done");

    for(;;);

    }
 }

zoomkat Yes i saw this code before and i will take it for next step after catch HTML >>> THank you