Created
November 28, 2016 10:54
-
-
Save ytakky2014/0aa98f461d98cc284dd0828b89e100c1 to your computer and use it in GitHub Desktop.
Use Imagga API Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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