How to query Google Cloud Platform Natural Language API using cURL in PHP (example code)

The following short example shows a simple example of how to query Google Natural Language API by posting JSON as text using cURL in PHP. 

This code is a simplified version of example code offered by Google on the following page, which uses cURL commands directly from the command line.

Using the below code, you can easily adjust the data posted to API, by specifying your own content.

The code above properly retrieves all of the entities of text after analysis by Google Natural Language API:



Facebook Comments