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

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

# ----------- cURL -----------
# set the URL for GET request, specify the url for information extraction and API key for authorization purposes (change YourAPIKey to the Intellexer API key)
$link = "http://api.intellexer.com/parse?apikey=YourAPIKey&url=http://www.euronews.com/2012/01/02/ailing-mubarak-back-in-court/&useCache=false";

# curl connection initialization
$ch = curl_init();

#set cURL options
curl_setopt_array($ch, array(
    CURLOPT_URL => $link,
    CURLOPT_POST => false,
    CURLOPT_HEADER => false,

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

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

    # print "Document structure"
    echo 'Document structure: ' . $json_results['structure'];

    # print "Document topics"
    echo "\n" . 'Document topics: ';
    $topics = $json_results['topics'];
    foreach ($topics as $topic) {
        echo $topic;

    # print "Document language"
    echo "\n" . 'Document language: ' . $json_results['lang'];

    # print "Document plain text"
    echo "\n" . 'Document plain text: ' . "\n" . $json_results['text'];

# ----------- END cURL -----------


Document structure: NewsArticle
Document topics: Social.law
Document language: English
Document plain text: 
Log in
Please enter your login details
 or Join the euronews community
02/01/12 14:07 CET
  | updated xx mn ago
  | updated at xx
The former Egyptian president Hosni Mubarak has been back in court after a two month delay in his trial over the deaths of hundreds of anti-government protesters. The ousted leader, whose doctors claim is suffering from heart problems, arrived at the Cairo tribunal on a stretcher.
He is accused of corruption and complicity in the killings of opponents during the uprising against his rule.
A judge, who some lawyers called to be dismissed over doubts about his impartiality, has been retained. That has fuelled demonstrations outside the court by anti-Mubarak protesters.
Their anger has been heightened by the recent acquittal of five policemen on charges of killing five protesters during the revolt.
More about:
Latest world news
Wires > News
Latest programmes
Copyright � euronews 2016