Created
March 27, 2016 18:29
-
-
Save germanattanasio/ca22c0d47755d6f023f1 to your computer and use it in GitHub Desktop.
Example of classifying an image using Visual Recognition in PHP
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 | |
$data = ; | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_POST => true, | |
CURLOPT_URL => "https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classify?version=2015-12-02", | |
CURLOPT_USERPWD => "USERNAME:PASSWORD", | |
CURLOPT_POSTFIELDS => array("images_file" => "@/path/to/your/image.png"), | |
CURLOPT_RETURNTRANSFER => true | |
)); | |
$response = curl_exec($curl); | |
$err = curl_error($curl); | |
curl_close($curl); | |
if ($err) { | |
echo "cURL Error #:" . $err; | |
} else { | |
echo $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the script . was really helpful for the hackathon