Nein, eigentlich sollte das passen. Hab das selbst gerade mal getestet mit dem einfache WebClient Beispiel der Ethernet-Lib.
Klappt recht gut. Allerdings wird das Parsen der HTML-Daten spannend, da die Webseite 58.000 Bytes groß ist.
Mit dem Textfinder klappt das aber recht gut:
Ausgabe auf dem Serial Monitor:
connecting...
connected
Tankstelle 1
Wilms-Wickrath, Dieselstr. 14-20, 1.449 Euro
Tankstelle 2
OIL!, Karlstrasse 59, 1.479 Euro
Tankstelle 3
Shell, HARDTER STR. 133, 1.489 Euro
Tankstelle 4
Shell, MARIE-BERNAYS RING, 1.489 Euro
Tankstelle 5
Shell, DUVENSTRASSE. 339, 1.499 Euro
Tankstelle 6
TOTAL, DAHLENER STR. 520, 1.519 Euro
Hier der Code dazu:
#include <SPI.h>
#include <Ethernet.h>
#include <TextFinder.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "www.clever-tanken.de"; // name address for Google (using DNS)
EthernetClient client;
TextFinder finder( client);
char preis1[10];
char preis2[5];
char tankstelle[100];
char adresse[100];
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");
Ethernet.begin(mac);
}
// 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 /tankstelle_liste?spritsorte=7&r=5&ort=41189&lat=&lon= HTTP/1.1");
client.println("Host: www.clever-tanken.de");
client.println("Connection: close");
client.println();
}
else {
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
int counter=1;
if (client.connected()) {
while(finder.find("addPoi")) {
finder.getString("class=\"price\">","<",preis1,10);
finder.getString("<sup>","</sup>",preis2,5);
finder.getString("location_name\">","</div>",tankstelle,100);
finder.getString("street_number\">","</div>",adresse,100);
Serial.print("Tankstelle ");
Serial.println(counter++);
Serial.print(tankstelle);
Serial.print(", ");
Serial.print(adresse);
Serial.print(", ");
Serial.print(preis1);
Serial.print(preis2);
Serial.println(" Euro");
}
client.stop();
}
while(1) {};
}