Forum Moderators: coopster

Message Too Old, No Replies

php PUT and DELETE

         

samdyk

9:31 am on Jun 10, 2008 (gmt 0)

10+ Year Member



hi all,

i wonder if php 5 have such variable $_PUT[] and $_DELETE[]. but i am sure that php 5 have $_POST[] and $_GET[].

if not have $_PUT[] and $_DELETE[], what can we do to handle such data in this PUT Request and DELETE Request.

thanks if have some idea about that.

jatar_k

11:57 am on Jun 10, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld samdyk,

I'm not really sure what you are trying to do. Obviously php does not have those superglobal arrays.

maybe a little example might help demonstrate the situation better.

penders

1:03 pm on Jun 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



i wonder if php 5 have such variable $_PUT[] ...

Is this relating to FTP ?

coopster

9:48 pm on Jun 10, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Probably not, I think samdyk is referring to RFC2616 PUT and DELETE methods. The information is available, just that it is going to be in either the $_SERVER or the $_ENV superglobals and the content in STDIN.

Outside of the security issues, you would process a PUT request by checking the $_SERVER['REQUEST_METHOD'] to make sure it is a PUT method, get your filename from REQUEST_URI or probably PATH_TRANSLATED, read $_SERVER['CONTENT_LENGTH'] bytes from STDIN (php://stdin/) [php.net], write your data out to the file and return your 201 or 204 status code to the user.