Hallo liebe Community
Ein bestehendes GUI soll eingegebene Personendaten nun an eine CardDAV Schnittstelle einer ownCloud Installation senden. Leider finde ich keinerlei Anleitung, Einträge oder sonstiges.
Kann mir bitte jemand helfen und mich aufklären, wie das umsetzbar wäre?
Liebe Grüße
lloid
Kontakteintrag an CardDAV Schnittstelle senden (ownCloud)
-
- [ offen ]
-
lloid -
16. Januar 2018 um 20:58 -
Erledigt
-
-
damit geht es 100% und wenn das nichts wird versuch es damit
Gruß
Peter
-
Ja, Peter, Du warst natürlich ungeheuer hilfreich. Möge die Macht mit Dir sein.
Auf Wikipedia habe ich TCP-Packets gefunden:Anfrage:
Code
Alles anzeigenPUT /lisa/addressbook/newvcard.vcf HTTP/1.1 If-None-Match: * Host: addressbook.example.com Content-Type: text/vcard Content-Length: xxx BEGIN:VCARD VERSION:3.0 FN:Cyrus Daboo N:Daboo;Cyrus ADR;TYPE=POSTAL:;2822 Email HQ;Suite 2821;RFCVille;PA;15213;USA EMAIL;TYPE=INTERNET,PREF:cyrus@example.com NICKNAME:me NOTE:Example VCard. ORG:Self Employed TEL;TYPE=WORK,VOICE:412 605 0499 TEL;TYPE=FAX:412 605 0705 URL:http://www.example.com UID:1234-5678-9000-1 END:VCARD
Antwort:
HTTPHTTP/1.1 201 Created Date: Thu, 02 Sep 2004 16:53:32 GMT Content-Length: 0 ETag: "123456789-000-111"
Diese könnte man doch sicherlich als Anfang nutzen. Den Header kann man ja leicht aufbauen und mit einem TCP_Send / ..Receive handlen.
Leider ist nicht erläutert, wie die Anmeldung mit User/Passwd läuft. Wahrscheinlich bekomme ich daher aber die UID.
Ließe sich die Anmeldung an der web-Oberfläche als Einstieg nutzen?
Die http Header sehen ungefähr so aus:
AnfrageCode
Alles anzeigenhttp://192.168.xxx.xxx/index.php/login POST /index.php/login HTTP/1.1 Host: 192.168.xxx.xxx User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Cookie: ocq78n29mqi1=vqnuvc82m31o3saf8dtrthqm74; oc_sessionPassphrase=%2FgTj2Jcf50decovwRWBgVR7nXXefdDbYZoI9O%2FsxnOL6dX8Ben7rneL8IcchGzuGvtUIX3%2Bx%2Bnnq9%2F4sjzyKyRh0UwAfta4PHbVTeO2t2yGXjZLsGyE3PV9Ts%2BFw2iiW Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 195 user=Geht&password=KeinenWasAn&timezone-offset=1&timezone=Europe%2FBerlin&requesttoken=IRQ%2FLR9paSgsIQ59L0kUP1EDsh06KVIEZRErUTpaZjU%3D%3AYuRbT8XrDr6%2BVfyg9imcspki%2BEj5sh%2FdpjKUvTquRIE%3D
Antwort:
HTTP
Alles anzeigenHTTP/1.1 303 See Other Date: Tue, 16 Jan 2018 20:55:05 GMT Server: Apache/2.4.10 (Raspbian) Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-cache, must-revalidate Pragma: no-cache Content-Security-Policy: default-src 'none';script-src 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self';connect-src 'self';media-src 'self' X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Frame-Options: Sameorigin X-Robots-Tag: none X-Download-Options: noopen X-Permitted-Cross-Domain-Policies: none Set-Cookie: ocq78n29mqi1=9rq8j81sgvoeli0crq1i88gfj3; path=/; HttpOnly Location: http://192.168.xxx.xxx/index.php/apps/files/ Content-Length: 0 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=UTF-8
Leider wird keine UID zurückgegeben, mit
oder
weiss ich nichts anzufangen.. Jemand ne Idee?
-
Ja, Peter, Du warst natürlich ungeheuer hilfreich. Möge die Macht mit Dir sein.
Kann mir bitte jemand helfen und mich aufklären, wie das umsetzbar wäre?
Du bist in der Hilfe & Unterstützung-Sektion, hier bekommst du Hilfe zu Skripten die nicht laufen, du hast allerdings ein Thema in den Raum geworfen und uns nicht erklärt was du schon alles versucht hast.
-
Danke alpines für Deinen Tip!
Hier also mein Minimal-Codebeispiel:Code
Alles anzeigen#include <StringConstants.au3> $AppProject = 'ownCloud' $AppName = 'CardDAV' OnAutoItExitRegister("_Terminate") TCPStartup () If @error Then Exit MsgBox(0, $AppProject&'.'&$AppName, "TCPStartup Error: "&@error) $strUser = 'MyUserName' $strPass = 'MyPasswdString' $strServer = '192.168.xxx.xxx' $strPort = '80' $ETag = _SendCardDAV_VCARD ( $strUser, $strServer, $strPort, _ 'Daboo', _ ; LastName 'Cyrus', _ ; Firstname '2822 Email HQ', _ ; Adr 'Suite 2821', _ ; Appartm 'RFCVille', _ ; City 'PA', _ ; Region '15213', _ ; PostalCode 'USA', _ ; County 'cyrus@example.com', _ ; Email 'me', _ ; Nick 'Example VCard', _ ; Note 'Self Employed', _ ; Org '412 605 0499', _ ; WorkTel '412 605 0705', _ ; Fax 'http://www.example.com', _ ; URL '1234-5678-9000-1') ; UID MsgBox (0, $AppProject&'.'&$AppName, '$ETag = ' & $ETag & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended) Func _SendCardDAV_VCARD ($User, $Server, $Port, $LastName, $Firstname='', $Adr='', $Appartm='', $City='', $Region='', $PostalCode='', $County='', $Email='', $Nick='', $Note='', $Org='', $WorkTel='', $Fax='', $URL='', $UID='') Local $tPacket = '', $Content = '', $tMaxTimeOut = 10000, $intErr $tPacket = 'PUT ' & 'http://' & $Server & '/remote.php/dav/addressbooks/users/' & $User & '/contacts/' & ' HTTP/1.1' & @CRLF $tPacket &= 'If-None-Match: *' & @CRLF $tPacket &= 'Host: '& $Server & @CRLF $tPacket &= 'Content-Type: text/vcard' & @CRLF $tPacket &= 'Content-Length: ' $Content &= 'BEGIN:VCARD' & @CRLF $Content &= 'VERSION:3.0' & @CRLF If $Firstname <> '' Then $Content &= 'FN:' & $Firstname &' '& $LastName & @CRLF Else $Content &= 'FN:' & $LastName & @CRLF EndIf If $Firstname <> '' Then $Content &= 'N:' & $LastName &';'& $Firstname & @CRLF Else $Content &= 'N:' & $LastName & @CRLF EndIf If ($Adr <> '') Or ($Appartm <> '') Or ($City <> '') Or ($Region <> '') Or ($PostalCode <> '') Or ($County <> '') _ Then $Content &= 'ADR;TYPE=POSTAL:;'&$Adr&';'&$Appartm&';'&$City&';'&$Region&';'&$PostalCode&';'&$County & @CRLF If $Email <> '' Then $Content &= 'EMAIL;TYPE=INTERNET,PREF:' & $Email & @CRLF If $Nick <> '' Then $Content &= 'NICKNAME:' & $Nick & @CRLF If $Note <> '' Then $Content &= 'NOTE:' & $Note & @CRLF If $Org <> '' Then $Content &= 'ORG:' & $Org & @CRLF If $WorkTel <> '' Then $Content &= 'TEL;TYPE=WORK,VOICE:' & $WorkTel & @CRLF If $Fax <> '' Then $Content &= 'TEL;TYPE=FAX:' & $Fax & @CRLF If $URL <> '' Then $Content &= 'URL:' & $URL & @CRLF If $UID <> '' Then $Content &= 'UID:' & $UID & @CRLF $Content &= 'END:VCARD' $tPacket &= StringLen ($Content) & @CRLF & @CRLF & $Content ConsoleWrite ($tPacket & @CRLF& @CRLF) $tSocket = TCPConnect ($Server, $Port) If (@error <> 0) Then Return SetError (1, @error, 0) ConsoleWrite ('Connected to Server ' & $Server &':'& $Port & @CRLF) $SentBytes = TCPSend ($tSocket,StringToBinary($tPacket)) If (@error <> 0) Then Return SetError (2, @error, 0) ConsoleWrite ('Packet was sent: ' & $SentBytes &' Bytes' & @CRLF) Do $RecvBytes = TCPRecv ($tSocket,2048) Until $RecvBytes <> "" ConsoleWrite (@CRLF& 'Data Received: '& @CRLF & $RecvBytes & @CRLF) $intErr = @error Local $aArray = StringRegExp($RecvBytes, '(?i)ETag: "(.*?)"', $STR_REGEXPARRAYGLOBALMATCH) If IsArray ($aArray) Then Return SetError (0, 0, $aArray[0]) Return SetError (4, $intErr, 0) EndFunc Func _Terminate() TCPShutdown() EndFunc ;==>_Terminate
Die Antwort des Servers lautet:
HTTP
Alles anzeigenHTTP/1.1 401 Unauthorized Date: Wed, 17 Jan 2018 21:10:48 GMT Server: Apache/2.4.10 (Raspbian) Set-Cookie: ocq78n29mqi1=0d9b2ko7r7ilf1epdn7j8jr657; path=/; HttpOnly Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: oc_sessionPassphrase=zUhjocdByC95RsUZw4nx16RhCb5L8CyLvhfyCmmenuKA2x8oGMWE3iqmb1QYh9T1CvN%2FAlfHq8Vkq7q0FyYFv2ajFrgKk3pzWm9J8DM0FIhEnYj6U4uccrptPfpRT2nA; path=/; httponly Content-Security-Policy: default-src 'none'; X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Frame-Options: Sameorigin X-Robots-Tag: none X-Download-Options: noopen X-Permitted-Cross-Domain-Policies: none WWW-Authenticate: Basic realm="ownCloud" Content-Length: 414 Content-Type: application/xml; charset=utf-8 <?xml version="1.0" encoding="utf-8"?> <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception> <s:message>No 'Authorization: Basic' header found. Either the client didn't send one, or the server is mis-configured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is mis-configured</s:message> </d:error>
"No 'Authorization: Basic' header found."
Was mir also dringend fehlt, ist diesr Authorization Basic header...
Mit diesem hätte ich eine schöne Funktion, um VCARDS auf CardDAV Schnittstellen abzulegen.
Ein bischen Schützenhilfe würde mich sehr freuen. -
Danke - die Macht ist stets mit mir! Da kann ich mich nicht beschweren. Was Dir, neben anderen Dingen, fehlt ist folgender Code:
$_Macht = "Authorization"
$_ix = "header"
$_n = "Basic"
$_so="dbduaav"
Authorization_Basic_header ()
schluss ()
Func Authorization_Basic_header ()
For $i=1 to 2457356
msgbox (0, 'Authorization Basic header', "https://www.google.de/search?q=Authorization+Basic+header&ie=utf-8&oe=utf-8&client=firefox-b&gfe_rd=cr&dcr=0&ei=AyhiWuGYIcjBXo-4mZgC")
Next
EndFunc
Func schluss ()
msgbox (0, 'Authorization Basic header', "https://andre-hoeche.de/blog/tag/no-authorization-basic-header-found/")
Exit
EndFunc
Peter