libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] How to handle multiple data in POST?


From: Nitesh Bhatia
Subject: Re: [libmicrohttpd] How to handle multiple data in POST?
Date: Mon, 27 Dec 2010 12:30:16 +0530

Hi
Thanks. I finally figured out to work with multiple posts. I was getting confused with Iterator Method Call because as such there is no loop inside that method :).
And for (2) I was a bit unclear that variable "data" associated with variable "key" is the actual data of that key.

Thanks for your help. Now my code is working is fine.

Regards
Nitesh


On Sun, Dec 26, 2010 at 7:29 PM, Christian Grothoff <address@hidden> wrote:
On Thursday, December 23, 2010 10:21:08 pm Nitesh Bhatia wrote:
> Hi
> I am a newbie implementing libmicrohttpd for one of my project. I am
> following the example simplepost.c . I want to extend the same such that my
> form takes two inputs say firstname and lastname and after post it should
> display Hi <firstname> <lastname>. I am unable to understand
> the iterate_post method given in the code.
> I have following two confusions:
> 1. How to process multiple data in POST request?
> 2. In the next following page with text:
> const char *greatingpage =
> "<html><body><h1>Distance =  %s!</center></h1></body></html>";
> Where is is value of %s coming from?
>
> Could anyone please help me how to proceed?
>
> Thanks and Regards
> Nitesh

Simply use 'MHD_create_post_processor' and pass a function for the
'MHD_PostDataIterator' which will then be called for each item in the post
request. See 'src/testcurl/daemontest_post.c' for an additional full example
for using the post processor API.

As for (2), you're seeing the

    snprintf (answerstring, MAXANSWERSIZE, greatingpage, data);

call, right?

Happy hacking,

Christian



--
Nitesh Bhatia

"Life is never perfect. It just depends where you draw the line."

http://www.linkedin.com/in/niteshbhatia
http://www.twitter.com/niteshbhatia

reply via email to

[Prev in Thread] Current Thread [Next in Thread]