@ 2013-09-02T12:17:09Z <?php
class OpenCalaisHandler
{
private $apiKey;
private $apiUrl = 'http://api.opencalais.com/enlighten/rest/';
private $contentType = 'TEXT/RAW';
private $outputFormat = 'Application/JSON';
private $relTag = 'http://www.stefan-nieuwenhuis.nl';
private $calcRel = true; //calculate relevance score?
private $enableMeta = false; //GenericRelations,SocialTags
private $rdfAccess = false; //save doc in Calais repository?
private $allowDist = false; //can data be distributed?
private $allowSearch = false; //allow data to be searched?
private $extId = md5('Stefan Nieuwenhuis');
private $submitter = 'Stefan Nieuwenhuis';
private $inputString = '';
function __construct($apiKey)
{
$this->apiKey = $apiKey;
$this->SetupConnection;
}
private function GetInput()
{
return $this->inputString;
}
private function SetupConnection()
{
$postFields = 'licenseID='.urlencode($this->apiKey);
$postFields .= '¶msXML='.urlencode($this->CreateParamXml());
$postFields .= '&content='.urlencode($this->GetInput());
$cf = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_POST, 1);
$response = curl_exec($cf);
return $response;
}
private function CreateParamXml()
{
$xml = <<<XML
<c:params xmlns:c="http://s.opencalais.com/1/pred/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<c:processingDirectives c:contentType="$this->contentType" c:enableMetadataType="$this->enableMeta" c:outputFormat="$this->outputFormat" c:docRDFaccesible="$this->rdfAccess" >
</c:processingDirectives>
<c:userDirectives c:allowDistribution="$this->allowDist" c:allowSearch="$this->allowSearch" c:externalID="$this->extId" c:submitter="$this->submitter">
</c:userDirectives>
<c:externalMetadata>
</c:externalMetadata>
</c:params>
XML;
return $xml;
}
}
$class = new OpenCalaisHandler('kx78mmny8st4qa8q5ry5uvv9');
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.19 0.016 0.050 12.39 5.4.18 0.020 0.040 12.40 5.4.17 0.019 0.042 12.40 5.4.16 0.020 0.044 12.39 5.4.15 0.012 0.051 12.39 5.4.14 0.016 0.046 12.09 5.4.13 0.013 0.049 12.07 5.4.12 0.021 0.041 12.03 5.4.11 0.020 0.038 12.03 5.4.10 0.016 0.049 12.02 5.4.9 0.013 0.045 12.02 5.4.8 0.016 0.045 12.03 5.4.7 0.015 0.045 12.02 5.4.6 0.021 0.037 12.02 5.4.5 0.019 0.040 12.02 5.4.4 0.018 0.040 12.01 5.4.3 0.024 0.050 12.00 5.4.2 0.021 0.044 12.01 5.4.1 0.016 0.046 12.01 5.4.0 0.031 0.147 11.49 5.3.27 0.032 0.066 12.72 5.3.26 0.022 0.042 12.72 5.3.25 0.026 0.098 12.72 5.3.24 0.016 0.048 12.72 5.3.23 0.019 0.045 12.71 5.3.22 0.014 0.048 12.68 5.3.21 0.018 0.051 12.68 5.3.20 0.017 0.056 12.68 5.3.19 0.034 0.100 12.68 5.3.18 0.018 0.052 12.67 5.3.17 0.021 0.045 12.67 5.3.16 0.022 0.040 12.67 5.3.15 0.017 0.047 12.67 5.3.14 0.018 0.047 12.66 5.3.13 0.018 0.045 12.66 5.3.12 0.019 0.046 12.66 5.3.11 0.018 0.049 12.66 5.3.10 0.016 0.047 12.12 5.3.9 0.016 0.046 12.10 5.3.8 0.018 0.106 12.09 5.3.7 0.019 0.049 12.09 5.3.6 0.020 0.041 12.07 5.3.5 0.016 0.045 12.02 5.3.4 0.014 0.047 12.02 5.3.3 0.019 0.040 11.99 5.3.2 0.016 0.046 11.77 5.3.1 0.016 0.044 11.73 5.3.0 0.016 0.045 11.71
preferences:dark mode live preview
138.41 ms | 1394 KiB | 7 Q