Skip to Navigation
Home
OpenCalais
  • How Does Calais Work?
  • News Room
  • Blog
  • Showcase
  • Documentation
  • Calais Community
  • Register
  • Calais Products
  • Home
  • Feeds
  • FAQ
  • Forums
  • Contact Us
Login | Request API Key
Home ›
Calais PHP and JSON Demos

Submitted by FranSan on Fri, 05/16/2008 - 13:51.
in
  • JSON
  • Official Gallery Item
  • PHP
  • RDF

This PHP code (server and client) demonstrates how to use Calais with PHP. We offer both the raw representation of the Internet browser and a document viewer  representation highlighting all the entities in the text. Download the attached file, which contains documentation as well as source files.

To enable your PHP demo in Safari and Firefox, see this posting from Pete Warden. 

The example of a JSON wrapper – code that runs on the server and converts the RDF into JSON format - is also presented. We will be releasing (soon) a much simpler JSON wrapper (based on RDF) and another format is based in Simple Output Format, as well as a Java application controlling the Calais Web Service.

Stay tuned.

To incorporate Calais relevance capability, use the following JSON code. (Provided by http://prima.appspot.com/).

CalaisJSONIf.php
foreach ($element_atts as $name => $value)
{
if ($name == "count")
{
$new_element["repeat"] = (integer)$value;
}
if ($name == "relevance")
{
$new_element["relevance"] = (float)$value;
}
AttachmentSize
Opencalais_PHP_09Feb19.tar_.gz5.25 MB
OpenCalais_PHP_09Feb19.zip3.97 MB

Home | Privacy | Terms of Service | We're in Beta+ | Site Map

© 2008, 2009, 2010 Thomson Reuters