@ 2013-09-02T12:21:42Z <?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');
$extId = md5('Stefan Nieuwenhuis');
?>
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.048 12.40 5.4.18 0.020 0.041 12.39 5.4.17 0.021 0.041 12.40 5.4.16 0.017 0.047 12.40 5.4.15 0.019 0.045 12.39 5.4.14 0.017 0.043 12.09 5.4.13 0.018 0.046 12.06 5.4.12 0.015 0.048 12.03 5.4.11 0.016 0.041 12.02 5.4.10 0.016 0.044 12.02 5.4.9 0.023 0.039 12.03 5.4.8 0.012 0.046 12.03 5.4.7 0.013 0.044 12.03 5.4.6 0.017 0.041 12.02 5.4.5 0.021 0.037 12.02 5.4.4 0.016 0.042 12.01 5.4.3 0.014 0.045 12.00 5.4.2 0.016 0.043 12.00 5.4.1 0.018 0.040 12.01 5.4.0 0.012 0.043 11.50 5.3.27 0.023 0.039 12.72 5.3.26 0.023 0.039 12.72 5.3.25 0.012 0.048 12.72 5.3.24 0.017 0.044 12.72 5.3.23 0.016 0.046 12.70 5.3.22 0.014 0.048 12.68 5.3.21 0.014 0.048 12.68 5.3.20 0.011 0.052 12.68 5.3.19 0.020 0.044 12.68 5.3.18 0.012 0.050 12.68 5.3.17 0.015 0.047 12.67 5.3.16 0.014 0.049 12.67 5.3.15 0.018 0.045 12.67 5.3.14 0.012 0.049 12.66 5.3.13 0.015 0.046 12.66 5.3.12 0.019 0.045 12.66 5.3.11 0.025 0.043 12.66 5.3.10 0.021 0.043 12.12 5.3.9 0.016 0.044 12.10 5.3.8 0.017 0.044 12.09 5.3.7 0.017 0.046 12.09 5.3.6 0.012 0.049 12.07 5.3.5 0.021 0.039 12.02 5.3.4 0.012 0.047 12.02 5.3.3 0.017 0.041 11.99 5.3.2 0.016 0.046 11.77 5.3.1 0.019 0.043 11.73 5.3.0 0.013 0.044 11.71
preferences:dark mode live preview
140.56 ms | 1394 KiB | 7 Q