+dns_world4you_add() {
+ fqdn=$(echo "$1" | _lower_case)
+ value="$2"
+ _info "Using world4you to add record"
+ _debug fulldomain "$fqdn"
+ _debug txtvalue "$value"
+
+ _login
+ if [ "$?" != 0 ]; then
+ return 1
+ fi
+
+ export _H1="Cookie: W4YSESSID=$sessid"
+ form=$(_get "$WORLD4YOU_API/")
+ _get_paketnr "$fqdn" "$form"
+ paketnr="$PAKETNR"
+ if [ -z "$paketnr" ]; then
+ _err "Unable to parse paketnr"
+ return 3
+ fi
+ _debug paketnr "$paketnr"
+
+ export _H1="Cookie: W4YSESSID=$sessid"
+ form=$(_get "$WORLD4YOU_API/$paketnr/dns")
+ formiddp=$(echo "$form" | grep 'AddDnsRecordForm\[uniqueFormIdDP\]' | sed 's/^.*name="AddDnsRecordForm\[uniqueFormIdDP\]" value="\([^"]*\)".*$/\1/')
+ form_token=$(echo "$form" | grep 'AddDnsRecordForm\[_token\]' | sed 's/^.*name="AddDnsRecordForm\[_token\]" value="\([^"]*\)".*$/\1/')
+ if [ -z "$formiddp" ]; then
+ _err "Unable to parse form"
+ return 3
+ fi
+
+ _resethttp
+ export ACME_HTTP_NO_REDIRECTS=1
+ body="AddDnsRecordForm[name]=$RECORD&AddDnsRecordForm[dnsType][type]=TXT&AddDnsRecordForm[value]=$value&AddDnsRecordForm[uniqueFormIdDP]=$formiddp&AddDnsRecordForm[_token]=$form_token"
+ _info "Adding record..."
+ ret=$(_post "$body" "$WORLD4YOU_API/$paketnr/dns" '' POST 'application/x-www-form-urlencoded')
+ _resethttp
+
+ if _contains "$(_head_n 1 <"$HTTP_HEADER")" '302'; then
+ res=$(_get "$WORLD4YOU_API/$paketnr/dns")
+ if _contains "$res" "successfully"; then
+ return 0
+ else
+ msg=$(echo "$res" | grep -A 15 'data-type="danger"' | grep "]*>[^<]" | sed 's/<[^>]*>//g' | sed 's/^\s*//g')
+ if [ "$msg" = '' ]; then
+ _err "Unable to add record: Unknown error"
+ echo "$ret" >'error-01.html'
+ echo "$res" >'error-02.html'
+ _err "View error-01.html and error-02.html for debugging"
+ else
+ _err "Unable to add record: my.world4you.com: $msg"
+ fi
+ return 1
+ fi
+ else
+ msg=$(echo "$ret" | grep '"form-error-message"' | sed 's/^.*
\([^<]*\)<\/div>.*$/\1/')
+ _err "Unable to add record: my.world4you.com: $msg"
+ return 1
+ fi
+}
+
+# Usage: dns_world4you_rm