Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Articles Tagged ‘http’

Advanced HTTP methods explained

Sunday, December 11th, 2016 by Servage
http-methodsGET and POST requests are the most common HTTP methods, but these are not the only ones you can use in your applications. You may have heard about PUT, PATCH and HEAD, and if you are working on an RESTful API, you should be using them. Let’s see what these less common HTTP methods are and when you should use them. PUT Request When speaking from a RESTful viewpoint, a POST request is used to create a new resource. When a resource has already been created, it can be updated with a PUT request. PUT replaces the entire resource, so you you are essentially recreating it when using a PUT request. This means you ...

Sending HTTP responses in Laravel

Sunday, May 3rd, 2015 by Servage
httpThe normal usage of Laravel on a website is that a client request to an endpoint results in a response, one way or the other. The request could be anything from a typical browser request for a given website for HTML or files, to an automated request from a client server to an API endpoint you publish for structured data responses like JSON or XML. Either way, at some point you need to create and return a response in your controller- and Laravel comes ready to do so with lots of options available. Responding from a route without a controller You can respond directly from a route, without making a controller and action method. ...