0

Hello,

I tried to integrate api of aylien which is used for article extraction I installed the sk succesffuly but when I tried to run my code it gives me an error

Trying to get property of non-object in C:\wamp\www\aylien\index.php on line 15
Notice: Trying to get property of non-object in C:\wamp\www\aylien\index.php on line 16

 My Code

 require __DIR__ . "/vendor/autoload.php";

# Or manually
# require_once("aylien_textapi_php/src/AYLIEN/TextAPI.php");

$text = 'http://mashable.com/2015/10/28/google-play-games-recording/#MkEUjgspYgq6';

$textapi = new AYLIEN\TextAPI("b1173fe1", "221ce5eb157b1f3be6be0176bd589d63");
$sentiment = $textapi->Sentiment(array("text" => $text));
$language = $textapi->Language(array("text" => $text));

echo 'Sentiment: ', $sentiment->polarity, ' (', $sentiment->polarity_confidence, ')' . PHP_EOL;
echo 'Language: ', $language->lang, ' (', $language->confidence, ')' . PHP_EOL;
$url = 'http://techcrunch.com/2015/07/16/microsoft-will-never-give-up-on-mobile';
$classifications = $textapi->ClassifyByTaxonomy(array("url" => $url, "taxonomy" => "iab-qag"));
foreach($classifications->categories as $category) {
  var_dump($category);
}

reff
http://aylien.com/sdks/
http://docs.aylien.com/docs/classify-taxonomy
https://developer.aylien.com/getting-started/php

please help me out with the configuration and usage

2
Contributors
2
Replies
9
Views
2 Years
Discussion Span
Last Post by UK-1991
0

Well as far as I beleive yes it is and if not please explain me how . and secondly I tried to modify and now I got rid from the error but now I am getting this output

null

updated code

 # To use the SDK either use Composer's autoload
require __DIR__ . "/vendor/autoload.php";

# Or manually
# require_once("aylien_textapi_php/src/AYLIEN/TextAPI.php");

    $textapi = new AYLIEN\TextAPI("b1173fe1", "221ce5eb157b1f3be6be0176bd589d63");

    $text = 'http://mashable.com/2015/10/28/google-play-games-recording/#MkEUjgspYgq6';

    $sentiment = $textapi->Sentiment(array("text" => $text));
    $language = $textapi->Language(array("text" => $text));

    $sentiment = $textapi->Sentiment(array(
        'text' => 'John is a very good football player!'
    ));

    $url = 'http://techcrunch.com/2015/04/06/john-oliver-just-changed-the-surveillance-reform-debate';
    $extract = $textapi->Extract(array('url' => $url, 'best_image' => 'true'));
    var_dump($extract);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.