Text Summarization API for PHP


To use our Text Summarization API in PHP, you need install the Unirest for PHP client library first.

Install With Composer

If you're using Composer to manage dependencies, you can add Unirest with it:

    "require" : {
        "mashape/unirest-php" : "dev-master"
    "autoload": {
        "psr-0": {"Unirest": "lib/"}

Install with source from GitHub

Unirest-PHP requires PHP V5.3+. Download the PHP library from Github, and require in your sciprt like so:

To install the source code:

git clone git@github.com:Mashape/unirest-php.git

And include it in your scripts:

reuqire_once '/path/to/unirest-php/lib/Unires.php';

Creating POST Requests

Now you are probaly wondering how using Unirest to creat requests for the Text Summarization API in PHP. Let's start with the previous json rquest body example:

    "url": "http://en.wikipedia.org/wiki/Automatic_summarization",
    "text": "",
    "sentnum": 8

The request created with Unirest PHP library like this:

$response = Unirest::post(
        "X-Mashape-Authorization" => "Your Mashape API Key",
        "Content-Type" => "application/json"

Here the Mashape API Key you can find in your Mashape account dashboard, copy it and replace it, now it's time to enjoy our Text Summarization API for your PHP Projects.

About Unirest

Unirest is a set of lightweight HTTP libraries available in multiple languages, ideal for most applications:

  • Make GET, POST, PUT, PATCH, DELETE requests
  • Both syncronous and asynchronous (non-blocking) requests
  • It supports form parameters, file uploads and custom body entities
  • Supports gzip
  • Supports Basic Authentication natively
  • Customizable timeout
  • Customizable default headers for every request (DRY)
  • Automatic JSON parsing into a native object for JSON responses


For other languages support by Text Summarization API, you can find the document link below: