Hallo Mario,
habe mich schon gewundert, welche Raute-Zeichen du meinst, habe somit sie ins Script gebracht - habe jetzt aber verstanden.
Also jetzt noch einmal - es ist die Demodatei "SimpleClientWithFinder" nur auf 1.01 angepasst.
/*
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
*/
#include <SPI.h>
#include <Ethernet.h>
#include <TextFinder.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[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(173,194,35,159); // Google
// 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;
TextFinder finder( client);
long hits; // the number of google hits
void setup() {
// start the serial library:
Serial.begin(9600);
// 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:
for(;;)
;
}
// 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.0");
client.println();
}
else {
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
hits = 0; // reset hit count
if(finder.find("Results <b>")){
if(finder.find("of")){
hits = finder.getValue(',');
Serial.print(hits);
Serial.println(" hits");
}
}
if(hits == 0){
Serial.println("No Google hits ");
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
for(;;)
;
}
}
Das sollte auch bei dir funktionieren - Google wird nach Arduino abgefragt nur es kommen keine Ergebnisse
Auch seltsam verhält sich bei einem anderen Script diese Funktion
client.print(LOGIN);
client.println("GET /search?q=Keller HTTP/1.0"); //hier soll doch nach "Keller" gesucht werden
client.println();
...
...
...
if (client.available()) { // wenn das zutrifft, wird das gespeichert
char c = client.read(); // hier abgefragt
Serial.print(c); //und hier alles ausgegeben
}
...leider wird hier der GANZE HTML-Code der Seite ausgegeben
Gruß Gerd
