So what you have is a post request and when that is finished you read the reply and write it to a file. You also have a method called ndlink() that is never called.
I would have expected that you want to call ndlink after the post succeeded.
What exactly does not work? You say that the post works and the code doen't try to do anything else.
Cheers,
_
Bookmarks