Swader / diffbot-php-client

[Deprecated - Maintenance mode - use APIs directly please!] The official Diffbot client library
MIT License
53 stars 20 forks source link

Questions about the right way to get subarray like images/tags #40

Closed realwindz closed 8 years ago

realwindz commented 8 years ago

Hi, I`m using the php library. Normally I use the field array as:

 $fields = array("author", "title", "siteName", "date", "icon", "images","html","tags"); // fields to be returned
 $json_diffr = $d->article($myurl, $fields);

But the returned json didn`t contain the scores or url as the website shown. I tried to use like this

$tag=array("scores","labels","url");
$fields=array("author","title",$tag);

but the json still not returning the scores for tags.

Swader commented 8 years ago

Hi,

which PHP client are you using? With this one (the one in whose repo you're in right now) it's as simple as:

$d = new Diffbot('mytoken');
$result = $d->createArticleAPI('http://www.cnn.com/2016/03/03/middleeast/syria-war/')->call();

$tags = $result->getTags();

No need for fields or anything else.

realwindz commented 8 years ago

OK, cool, seems like you updated the API. I was using this one: https://github.com/diffbot/diffbot-php-client

Maybe you can redirect your PHP library to this new one API

Swader commented 8 years ago

Ah, yes, forgot about that - I've put up a deprecation notice and will do a full redirect soon.