예제 #1
0
<?php

/**
* Example usage for the Open Calais Tags class written by Dan Grossman
* (http://www.dangrossman.info). Read about this class and how to get
* an API key at http://www.dangrossman.info/open-calais-tagsopen-calais-tags
*/
require 'opencalais.php';
$apikey = "5b92grdzuyjfmqbkw79atzy5";
$oc = new OpenCalais($apikey);
$content = <<<EOD

April 7 (Bloomberg) -- Yahoo! Inc., the Internet company that snubbed a \$44.6 billion takeover bid from Microsoft Corp., may drop in Nasdaq trading after the software maker threatened to cut its bid if directors fail to give in soon.

If Yahoo's directors refuse to negotiate a deal within three weeks, Microsoft plans to nominate a board slate and take its case to investors, Chief Executive Officer Steve Ballmer said April 5 in a statement. He suggested the deal's value might decline if Microsoft has to take those steps.

The ultimatum may send Yahoo Chief Executive Officer Jerry Yang scrambling to find an appealing alternative for investors to avoid succumbing to Microsoft, whose bid was a 62 percent premium to Yahoo's stock price at the time. The deadline shows Microsoft is in a hurry to take on Google Inc., which dominates in Internet search, said analysts including Canaccord Adams's Colin Gillis. 

EOD;
$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>";
}
예제 #2
0
<?php

// verify email address
setupAppFramework();
if (isset($_GET['test'])) {
    require_once PATH_CORE . '/classes/remotefile.class.php';
    $rfObj = new remotePageProperty($_GET['url']);
    echo $rfObj->getPageTitle();
    $matches = $rfObj->getPageParagraphs();
    print_r($matches);
    require_once PATH_CORE . '/utilities/calais/opencalais.php';
    $oc = new OpenCalais($init['calais']);
    $entities = $oc->getEntities($matches);
    foreach ($entities as $idea) {
        echo $idea . "<br />";
    }
    exit;
    foreach ($entities as $type => $values) {
        echo "<b>" . $type . "</b>";
        echo "<ul>";
        foreach ($values as $entity) {
            echo "<li>" . $entity . "</li>";
        }
        echo "</ul>";
    }
    exit;
}
if (!isset($_GET['e']) and !isset($_GET['a'])) {
    $result = false;
    $app->facebook->redirect(URL_CANVAS . '?p=home&msgType=error&&msg=' . urlencode('There was a problem with your request.'));
} else {