Skip to content

Instantly share code, notes, and snippets.

@ytakky2014
Created November 28, 2016 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ytakky2014/0aa98f461d98cc284dd0828b89e100c1 to your computer and use it in GitHub Desktop.
Save ytakky2014/0aa98f461d98cc284dd0828b89e100c1 to your computer and use it in GitHub Desktop.
Use Imagga API Sample
<?php
use Curl\Curl;
$curl_url = "https://api.imagga.com/v1/tagging"
$curl = new Curl();
$curl->setopt(CURLOPT_HEADER, FALSE);
$curl->setopt(CURLOPT_RETURNTRANSFER, TRUE);
$curl->setBasicAuthentication($api_key, $api_secret);
$curl->get($curl_url, array(
'url' => $file,
'language' => 'ja'
));
$response = json_decode($curl->response);
$results = $response->results;
$tags = $results[0]->tags;
foreach ($tags as $tag) {
echo "confidence : " . $tag->confidence . " tag : " . $tag->tag . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment