Hi to all ,
I am looking for a sample to export data sensor on a linux remote computer with Apache2 webdav.
I need to monitor and record volts and ampere of a battery every 10 minutes.
Do you have any suggestion ?
Thanks in advance,
Why does it have to be WebDAV? That's a rather uncommon protocol (remote file system) for such a task. I'm not aware of a WebDAV client library for the Arduino environment.
There are libraries for the other way around: running the WebDAV server on the ESP, the Linux computer can be the client then, if the protocol is fixed to WebDAV for some reason.
I try using http connection but I had error 401
[HTTP] begin...
MYPATH OK: http://192.168.1.11/webdav/sample.txt
[HTTP] GET...
[HTTPS] GET... code: 401
void httpConnection( WiFiClient& client )
{
HTTPClient http;
Sprintln("[HTTP] begin...\n");
http.setAuthorization( httpsUser, httpsPass );
if (http.begin(client, MYPATH)) {
Sprintf( "MYPATH OK: %s\n", MYPATH );
Sprintln("[HTTP] GET...\n");
int httpCode = http.GET();
// httpCode will be negative on error
if (httpCode > 0) {
Sprintf("[HTTPS] GET... code: %d\n", httpCode);
// file found at server
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
String payload = http.getString();
Sprintln(payload);
}
} else {
Sprintf("[HTTPS] GET... failed, error: %s\n", http.errorToString(httpCode).c_str() );
}
http.end();
} else {
Sprintln(F("[HTTP]Unable to connect\n"));
}
}
Last login: Fri Jan 6 17:39:38 on ttys000
max@macMax:~$ curl --basic --user 'max:123456789' '192.168.1.11/webdav/sample
.txt'
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<hr>
<address>Apache/2.4.52 (Ubuntu) Server at 192.168.1.11 Port 80</address>
</body></html>
max@macMax:~$
From Mac with Finder I can connect and no limitation on edit copy duplicate delete ecc.
Please answer my question from post #2.
Implementing WebDAV isn't as easy as it might look like if you do it on your Mac (remember: your Mac does lots of things without informing you).
Hi,
I make little progress, using curl I can write on webdav
max@macMax:~$ curl --digest --user max:magic -d "hello" -X PUT http://192.168.1.11/webdav/test.txt
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /webdav/test.txt has been created.</p>
<hr />
<address>Apache/2.4.52 (Ubuntu) Server at 192.168.1.11 Port 80</address>
</body></html>
I am looking for any working example to use with esp32 with digest authentication, on line I found a lot but no one is working usually for md5 library problem
I cannot fixed with webdav, instead I used Ftp connection and on ther server I write a program to append data, because FTP doesn't have this option.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.