Download PHP Web Services (2nd Edition) by Lorna Jane Mitchell PDF

By Lorna Jane Mitchell

No matter if you're sharing facts among inner platforms or development an API in order that clients can entry their info, this useful consultant has every thing you want to construct APIs with Hypertext Preprocessor. writer Lorna Jane Mitchell presents plenty of hands-on code samples, real-world examples, and recommendation in response to her wide adventure to lead you thru the process—from the underlying concept to tools for making your provider robust.

You'll tips on how to use this language to paintings with JSON, XML, and different internet provider applied sciences. This up to date moment version comprises new instruments and contours that mirror Hypertext Preprocessor updates and alterations on the internet.

Show description

Read or Download PHP Web Services (2nd Edition) PDF

Best programming books

OpenGL ES 2.0 Programming Guide

OpenGL ES 2. zero is the industry’s best software program interface and images library for rendering refined 3D snap shots on hand-held and embedded units. With OpenGL ES 2. zero, the complete programmability of shaders is now on hand on small and transportable devices—including cellphones, PDAs, consoles, home equipment, and cars.

Flow-Based Programming: A New Approach To Application Development (2nd Edition)

Written via a pioneer within the box, it is a thorough consultant to the price- and time-saving merits of Flow-Based Programming. It explains the theoretical underpinnings and alertness of this programming strategy in useful phrases. Readers are proven the right way to practice this programming in a couple of parts and the way to prevent universal pitfalls.

Objective-C Quick Syntax Reference

The Objective-C quickly Syntax Reference is a condensed code and syntax connection with the preferred Objective-C programming language, that's the middle language at the back of the APIs present in the Apple iOS and Mac OS SDKs. It provides the fundamental Objective-C syntax in a well-organized structure that may be used as a convenient reference.

Object-Oriented Programming in C++ (4th Edition)

Object-Oriented Programming in C++ starts off with the fundamental ideas of the C++ programming language and systematically introduces more and more complicated subject matters whereas illustrating the OOP technique. whereas the constitution of this e-book is identical to that of the former version, every one bankruptcy displays the most recent ANSI C++ usual and the examples were completely revised to mirror present practices and criteria.

Additional info for PHP Web Services (2nd Edition)

Sample text

Headers that aren’t “official” can always be used (sometimes they are prefixed with X- but they don’t have to be), so you can make use of this in your own applications if you wish. A good example, often seen on the Web, is when a tool such as Varnish has been involved in serving a response, and it adds its own headers. 1 varnish Connection: keep-alive That additional X-Varnish header shows me that Varnish served the request. info and on the Web. A great example comes from GitHub. v3 X-GitHub-Request-Id: 5EC19EE1:61C0:10B4CDB:55A0DAD5 X-Content-Type-Options: nosniff X-Served-By: 13d09b732ebe76f892093130dc088652 There are a few custom headers in this example but the X-RateLimit-* headers are particularly worth noting; they check whether too many requests are being made.

In fact, this is a PHP array (because those are easy to understand and work with), which is then converted to JSON using json_encode(). The resulting output is given as the value for CURLOPT_POSTFIELDS and PHP sends it as the body of the request. This example also sets some headers using the CURLOPT_HTTPHEADER option. The first one is Content-Type, which we have already seen in many examples, and the second one is Authorization. The Authorization header here includes the “token” and the access token within it, because the GitHub API uses OAuth2 for authorization.

In order to use PHP to make a request that the previous script can handle, it is neces‐ sary to create the contents of the body of the request and specify that it is a PUT request. info The PUT verb is specified in this example, and the correct header for the formencoded data is set. We dictate the data to PUT (manually building the form elements into a string) and then send the request. We will discuss more about other data for‐ mats in Chapter 5 and Chapter 6, which cover JSON and XML specifically, but the basic principles of preparing the data and setting the Content-Type header accord‐ ingly still stand.

Download PDF sample

Rated 4.88 of 5 – based on 21 votes