[Twisted-Python] HTTP POST method in php on twisted server

Tux Attack tuxattack14 at gmail.com
Mon Apr 19 01:29:11 EDT 2010


On Sun, Apr 18, 2010 at 8:53 PM, <exarkun at twistedmatrix.com> wrote:

> On 16 Apr, 04:24 am, tuxattack14 at gmail.com wrote:
> >Hi,
> >I am trying to use php script on twisted server using twcgi.I want to
> >make
> >use of http POST method in that.What I want to do is, suppose I am
> >having
> >one html page say index.html and from that page I want to redirect to
> >other
> >php page and pass data to that php page using POST method.But I am not
> >able
> >to access any POST data in php script.When I debugged through
> >twcgi.CGIScript.render method, I didn't find any reference to POST
> >data.So
> >how can i make use of POST data in php ?
>
> I don't really understand the question.  You have a lot of stuff going
> on here:
>
>  * HTTP POSTs
>  * Redirects
>  * CGIScript
>  * PHP
>
> Can you try to describe the scenario you're trying to get working step
> by step, carefully separating each of these different pieces?
>
> You may also want to post follow-ups to the twisted-web mailing list
> instead.
>
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>

My aim is to build a server that will support file uploading on server and
uploading is to be done using web browser.So i selected php script for file
upload.
I made a simple html form.

> <html>
> <body>
> <div align="center">
> <br />
> <form enctype="multipart/form-data" action="upload_file.php" method="POST">
>  Please choose a file: <input name="upload_file" type="file" /><br />
>  <input type="submit" value="Upload" />
>  </form> </body>
> </html>
>


Now this file is sent using POST method and then it will redirect to a php
script named upload_file.php.
So to make use of php i used twcgi.PHPScript. When i checked i am not
getting POST data in php code.
Execution calls twcgi.CGIScript.render method internally.When i checked in
this render method, data sent using POST is available in request.args
variable but not sent to php CLI.
Whereas in case of GET method the url is parsed and data sent using GET
method is put in qargs variable and then sent to php CLI.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100419/b4a668a5/attachment.htm 


More information about the Twisted-Python mailing list