Re: HTTP methods, Web Browsers and REST

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

 



Chris,

thanks for your reply

it sounds like apache does allow the use of a script to handle PUT requests

In fact, Apache handles PUT exactly like it handles the POST method. That
is, it supports it, but in order for it to do anything useful you need to
supply a suitable CGI program.

getting php to handle PUT requests is probably not too complicated..  there
is this other constraint, imposed by the protocol, that is noteworthy:

Another difference is that the POST method can be used in response to a
form, while the PUT method can only contain a single data item.

so, perhaps, in designing a page intended to allow the user to create a new
datum in an application, the data elements should probably be sent delimited
by / in the url; then parsing the url would provide the script w/ the
elements it needed to create the  new datum in the application.

this helps me to  understand the basics of using PUT and DELETE in a php
application, but im still unclear as to how PUT and DELETE methods can be
invoked on the server from a browser.  to be specific, is a client side
scripting technology like javascript or otherwise mandatory in order to
invoke PUT and DELETE from the browser, or is there some way to invoke these
methods on the server natively ??

from the sound of it; PUT and DELETE wont work well when using a browser to
interact w/ a server, it seems like they are mostly supplied for
programmatic interaction only, but that sounds odd to me....  i wonder what
the intended use of PUT and DELETE was when they were first created and
added to the HTTP.

-nathan

On 8/14/07, Chris <dmagick@xxxxxxxxx> wrote:
>
>
> > Looking over PHP i can see a web service client
> > could be written for a
> > RESTful web service using the curl extension (and perhaps others as
> well)
> > because it facilitates an
> > ability to invoke the HTTP PUT and DELETE methods.
> > Now, coming to my question..  Looking at the W3C page on the XHTML 1.0form
> > tag specification <http://www.w3schools.com/tags/tag_form.asp>, it is
> > clear the method attribute supports only  get and post.  What i wonder
> is
> > why would it not also support
> > put and delete?
>
> Because they are not part of forms, they are something the webserver
> needs to handle.
>
> http://www.apacheweek.com/features/put
>
> Particularly this sentence:
>
> "POST method is normally handed a script which is explicitly named by
> the resource (that is, something that already exists), while a PUT
> request could be directed at a resource which does not (yet) exist."
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux