Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Mmiscool
#27035 hello.

I am attempting to find a function that will fetch a web page and return a sting.

Some thing like
Code: Select allString FetchURL(String WebAddress, TimeOut){
...
}


Some one must have some thing pre-built to do this task. Searched the forum for about 20 minuets looking but nothing was very clear about fetching a url.
User avatar
By martinayotte
#27037 Here is some snippet of code that get external IP address, just by changing the site and URL will fetch almost anything you want to.

Code: Select all  WiFiClient client;
  if (!client.connect("api.ipify.org", 80)) {
    p.println("Failed to connect with 'api.ipify.org' !");
  }
  else {
    client.print("GET /?format=json HTTP/1.1\r\nHost: api.ipify.org\r\n\r\n");
    delay(100); 
    String = "";
    while(client.available()){
      str += client.read();
    }         
    Serial.print(str);
  } 
User avatar
By Mmiscool
#27202 Just picked this back up after a few days. Not quite ubderstaning the code. It seems like the server and the server url are not the same.

So to make this in to a function the url will have to be parsed fortheserver and for the actual url request.
Is this a correct asumption.

I find it hard to belive that there is not an existing function to do this. :?: