At first i was extremely disturbed that there are no good examples of PHP from nuki. Then I made the effort to program everything myself and put the whole thing here in the forum to help others.
Now my post is constantly marked as SPAM because it has the URL of Nuki in the program code.
Sorry that could be better!!!