Forum: Mikrocontroller und Digitale Elektronik Arduino -cURL einbinden Problem


von Andreas B. (andreas_del)


Lesenswert?

Liebe User,

ich habe mich neu in diesem Forum angemeldet.
Erstmal ein Hallo an alle!

Ich habe ein Arduino Uno mit EthernetShield und möchte damit eine 
Website parsen. Wie kann man das mit CURL machen?  Ich habe versucht die 
Lib von
https://curl.haxx.se/download.html mit der Arduinosoftware einzubinden. 
Geht aber nicht. :-(   Da kommt, dass die Bibliothekendatei nicht passt.

Mit einer "normalen"  Verbindung (ohne CURL) gehts schonmal. Ich brauche 
aber dringend CURL um die Funktionen curl_easy_setopt usw. verwenden zu 
können. Kann da jemand weiterhelfen?

Mit folgendem Code, geht zumindest eine unverschlüsselte Verbindung. Das 
reicht aber nicht weil ich https mit htacces verwenden muss...

LG Andreas
1
 
2
#include <SPI.h>
3
#include <Ethernet.h>
4
5
6
byte mac[] = { 
7
 0x82, 0xC0, 0x50, 0xFB, 0xCD, 0xE7 };
8
9
IPAddress ip(192,168,0,80);
10
 
11
char server[] = "meine-domain.de";    // name address (using DNS)
12
13
EthernetClient client;
14
15
void setup() {
16
  Serial.begin(9600);
17
   while (!Serial) {
18
    ; 
19
  }
20
21
  // start the Ethernet connection:
22
  if (Ethernet.begin(mac) == 0) {
23
    Serial.println("Failed to configure Ethernet using DHCP");  
24
    Ethernet.begin(mac, ip);
25
  }
26
  // give the Ethernet shield a second to initialize:
27
  delay(1000);
28
  Serial.println("connecting...");
29
30
  // if you get a connection, report back via serial:
31
  if (client.connect(server, 80)) {
32
    Serial.println("connected");
33
    
34
  // Make your API request:
35
    client.println("GET /ordner/test.php HTTP/1.1");
36
    client.println("Host: meine-domain.de");
37
    client.println("Connection: close");
38
    client.println();  
39
  } 
40
  
41
  else {
42
    // kf you didn't get a connection to the server:
43
    Serial.println("connection failed");
44
  }
45
}
46
47
void loop()
48
{
49
  // if there are incoming bytes available 
50
  // from the server, read them and print them:
51
  if (client.available()) {
52
    char c = client.read();
53
    Serial.print(c);
54
  }
55
56
  // if the server's disconnected, stop the client:
57
  if (!client.connected()) {
58
    Serial.println();
59
    Serial.println("disconnecting.");
60
    client.stop();
61
62
    // do nothing forevermore:
63
    while(true);
64
  }
65
}

von Einer K. (Gast)


Lesenswert?

Alles was cURL kann, kannst du auch per Hand erledigen.

Und nein!
Dein UNO wird mit einer vollständigen cURL Implementierung hoffnungslos 
überfordert sein.
cURL ist also für dich gestorben.

von Andreas B. (andreas_del)


Lesenswert?

Arduino Fanboy D. schrieb:
> Alles was cURL kann, kannst du auch per Hand erledigen.

Wie bekomme ich von Hand einen htaccess hin ?
Ohne SSL genügt ja die Url benutzername:passwort@domain.
Wie geht das mit SSL / https ?

LG
Andreas

von Einer K. (Gast)


Lesenswert?

HTTPS mit 2K Ram 32K Flash?
Viel Spass!

Aus meiner bescheidenen Sicht:
Keine Chance.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.