Example

Example

<?php

# Description: SpellChecker API usage example.
# Copyright: (C) 2016 EffectiveSoft Ltd. All Rights Reserved.
# Technical support: technical-support@effective-soft.com

header('Content-Type: text/plain');

$text = "EuropeanUnion leaders need to be bolder in how they tackle the eurozone crisis, reduce budget deficets and encourage growt, Prime Minister David Cameron said today.";

# ----------- cURL -----------
# set the URL with parameters for POST request and specify API key for authorization purposes (change YourAPIKey to the Intellexer API key)
$link = "http://api.intellexer.com/checkTextSpelling?apikey=YourAPIKey&language=ENGLISH&errorTune=2&errorBound=3&minProbabilityTune=2&minProbabilityWeight=30";
$header = array('Content-type: application/octet-stream');

# curl connection initialization
$ch = curl_init();

#set cURL options
curl_setopt_array($ch, array(
    CURLOPT_URL => $link,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HEADER => false,
    CURLOPT_HTTPHEADER => $header,
    CURLOPT_POSTFIELDS => $text,
    CURLOPT_FOLLOWLOCATION => true
));

# perform the request
$results = curl_exec($ch);

# error checking
if (curl_errno($ch))
{
    echo 'CURL error: ' . curl_error($ch);
}
else
{
    # parse JSON results
    $json_results = json_decode($results, true);

    # print source and processed sentences
    $src_sent = $json_results['sourceSentences'];
    $proc_sent = $json_results['processedSentences'];

    for ($i = 0; $i < sizeof($src_sent); $i++) {
        echo 'Source:' . "\t" . $src_sent[$i] . "\n";
        echo 'Corrected:' . "\t" . $proc_sent[$i] . "\n";
    }

    # print list of corrections
    echo "\n" . 'List of corrections' . "\n";
    $corrections = $json_results['corrections'];
    foreach ($corrections as $corr) {
        echo "\t" . $corr['v'][0]['t'] . "\n";
    }
}

curl_close($ch);
# ----------- END cURL -----------

Output

Source:	EuropeanUnion leaders need to be bolder in how they tackle the eurozone crisis , reduce budget deficets and encourage growt , Prime Minister David Cameron said today . 
Corrected:	European Union leaders need to be bolder in how they tackle the eurozone crisis, reduce budget deficits and encourage growth, Prime Minister David Cameron said today.

List of corrections
	European Union
	deficits
	growth