Open Calais API & examples – PHP


Open Calais is a rapidly growing toolkit of capabilities that allow you to readily incorporate state-of-the-art semantic functionality within your blog & provide more or less same functionality as what zemanta guys do.

Open calais use NLP to manipulate user’s queries. They are giving API access to multiple languages. Here i can explain the samples with php.

Live URL : http://livebillion.com/calais/

index.php

<form name=”calais” action=”octest.php” method=”post”>

URL : <input type=”text” name=”url” value=”” /> <input type=”submit” name=”submit” value=”Get Tags!” />

</form>

octest.php

$apikey = “XXXXXXXXXX”;

$oc = new OpenCalais($apikey);

if(isset($_REQUEST[“url”])){
$content = file_get_contents($_REQUEST[“url”]);
}

//echo $content;

$entities = $oc->getEntities($content);

foreach ($entities as $type => $values) {

echo “<b>” . $type . “</b>”;
echo “<ul>”;

foreach ($values as $entity) {
echo “<li>” . $entity . “</li>”;
}

echo “</ul>”;

}

opencalais.php

http://www.dangrossman.info/open-calais-tagsopen-calais-tags
All the best :)