Example
<?php
# Description: Natural Language Interface API usage example.
# Copyright: (C) 2016 EffectiveSoft Ltd. All Rights Reserved.
# Technical support: technical-support@effective-soft.com
header('Content-Type: text/plain');
# sample user query
$query = "How to increase an integration density in semiconductor memory device?";
# ----------- cURL -----------
# set the URL for POST request and specify API key for authorization purposes (change YourAPIKey to the Intellexer API key)
$link = "http://api.intellexer.com/convertQueryToBool?apikey=YourAPIKey";
$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 => $query,
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 "User query in the Boolean form"
echo 'User query in the Boolean form: ' . "\n" . $json_results;
}
curl_close($ch);
# ----------- END cURL -----------
Output
User query in the Boolean form:
increase OR increasing integration density semiconductor memory device