JSON API Client [PHP Code]

ReqBin is the best Online JSON API Client for API developers and testers. Quickly and easily make JSON API calls to any REST API endpoint and inspect server responses with ReqBin Online JSON API Client. Check JSON API status codes, response times, and sizes. Inspect JSON API responses with automatic syntax highlighting and validators. Click Send to execute your JSON API request online and see the results. The PHP code was automatically generated for the JSON API Client example.
JSON API Client [PHP Code] Send
POST /echo/post/json HTTP/1.1
Host: reqbin.com
Content-Type: application/json
Content-Length: 52

{
  "Id": 78912,
  "Quantity": 1,
  "Price": 18.00
}
Updated: Viewed: 24068 times
PHP code for JSON API Client example

PHP code for JSON API Client Example

This PHP code snippet was generated automatically for the JSON API Client example.
<< Back to the JSON API Client example

What is JSON?

JSON (stands for JavaScript Object Notation) is a format for storing and transmitting data over a network, used in almost all scripting languages, including Java, JavaScript, PHP, Python, C++, C#, Go, and many others. Web applications use JSON to exchange data between a web browser and a server and exchange data between servers via REST or JSON APIs. JSON file names use the .json file extension.

JSON Example
{
  "Id": 78912,
  "Customer": "Jason Sweet",
  "Quantity": 1,
  "Price": 18.00
}

What is API?

Application Programming Interface is definitions and protocols for building and integrating application software. An API is a software intermediary that allows two systems to communicate. APIs are usually readily available to developers, well documented, suitable for use in version control systems, and conform to HTTP and REST standards.

What is JSON API?

JSON API is a specification for how clients should request data from the server and how the server should respond to those requests. JSON API is designed to minimize the number of requests and the amount of data transmitted between clients and servers. The JSON API is fully described on JSONAPI.org

How extract JSON data from API?

The following is an example of sending a JSON API request to the ReqBin echo URL:

JSON API Request Example
POST /echo/post/json HTTP/1.1
Host: reqbin.com
Content-Type: application/json
Content-Length: 52
      
{
  "Id": 78912,
  "Quantity": 1,
  "Price": 18.00
}

Server response to our JSON API request:

JSON API Response Example
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 19

{"success":"true"}

See also

Generate code snippets for PHP and other programming languages

Convert your JSON API Client request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the PHP code generator.