Browsers by default use GET. I don't know offhand how to force a browser to send a POST, but it'll take you about 2 minutes to create a form that looks like this:
<form action="URL_TO_YOUR_APP" method="POST"> <input type="submit" /> </form> Add the values as input fields. When you hit submit, it will force a post to your target site. This should also display the output. This is actually easier to do using curl, so check your man pages on sending parameters. It's also easier to programmatically verify that way. -- Ikai Lan Developer Programs Engineer, Google App Engine plus.ikailan.com | twitter.com/ikai On Thu, Aug 11, 2011 at 1:43 AM, Ankur Deshwal <[email protected]>wrote: > Hi, > > I am new to web programming ( certainly to GAE ). I need have an > arrangement where I can update data from my custom C code and display > it on web. I found that HTTP POST is a good candidate to upload > "light" data. > > I am trying to understand the GAE and web programming simultaneously > and have modified code available on net to try out the possibilities > for the same. > > Here is the code for GAE. > > <import package here> > > class GetPage(webapp.RequestHandler): > def get(self): > self.response.out.write(""" > <html> > <body> > <p> In Get </p> > </body> > </html>""") > > class PostPage(webapp.RequestHandler): > def post(self): > self.response.out.write('<html><body>In Post<pre>') > > self.response.out.write(cgi.escape(self.request.get('content'))) > self.response.out.write('</pre></body></html>') > > application = webapp.WSGIApplication( [('/', GetPage), ('/post', > PostPage)], debug=True) > > def main(): > run_wsgi_app(application) > > if __name__ == "__main__": > main() > > > The client code (written in python for experimentation now, planning > to use libcurl for C later) which can send a Http POST request is here > - > > h = httplib2.Http() > form_fields = { > "content" : "Yippy!! POST works" > } > data = urllib.urlencode(form_fields) > > resp, content = h.request('http://107.108.58.183:8080', 'POST', > data) > > > When I host the GAE code, I am able to process GET request ( able to > see the GetPage output ). > However, when I send a POST request via client, I see no output in > browser( which is obvious since browser did not send the POST > request). However, I see the local GAE server prints message > indicating it has received the POST request). > > The question is- how can I display the data ( string "Yippy!! POST > works" here) on the web page when asked for from a browser? > > I am newbie in the field and will highly appreciate any help. > > Thanks, > Ankur > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
