PHP code example of tineye / tineye-api

1. Go to this page and download the library: Download tineye/tineye-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tineye / tineye-api example snippets



// Sandbox key
// Note that this is the same value as the old private_key
$api_key = '6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^';
$tineyeapi = new tineye\api\TinEyeApi($api_key);


// Sandbox keys
$public_key = 'LCkn,2K7osVwkX95K4Oy';
$private_key = '6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^';
$tineyeapi = new tineye\api\TinEyeApi($private_key, $public_key);


$tineyeapi = new tineye\api\TinEyeApi($api_key);


$tineyeapi = new tineye\api\TinEyeApi();


$params = [
    'offset' => 0,
    'limit' => 10,
    'backlink_limit' => 100,
    'sort' => 'score',
    'order' => 'desc',
    'domain' => 'tineye.com',
];


/**
* Search for an image using an image URL
*
* @param String $url Image URL to be downloaded and searched
* @param Array $params Optional General Arguments
* @return Array Multidimensional Array of the returned JSON
*/

$tineyeapi = new tineye\api\TinEyeApi($api_key);
$search_result = $tineyeapi->searchUrl('https://tineye.com/images/meloncat.jpg');


/**
* Search for an image using local image data
* TinEye supports JPEG, PNG, WEBP, GIF, BMP, or TIFF image formats
*
* @param String $image_data fopen stream of an image
* @param String $file_name Name of the file to be uploaded
* @param Array $params Optional General Arguments
*
* @return Array Multidimensional Array of the returned JSON
*/
$tineyeapi = new tineye\api\TinEyeApi($api_key);
$search_result = $tineyeapi->searchData(
    fopen('./tests/meloncat.jpg', 'r'),
    'meloncat.jpg'
);


/**
* Returns information on search bundles 
* @return Array Multidimensional array of the returned JSON
*/
$tineyeapi = new tineye\api\TinEyeApi($api_key);
$search_bundles = $tineyeapi->remainingSearches();


/**
* Returns the count of images in the TinEye index 
* @return Array Multidimensional array of the returned JSON
*/
$tineyeapi = new tineye\api\TinEyeApi($api_key);
$image_count = $tineyeapi->imageCount();


/**
* Returns the wrapped Guzzle client instance
* @return GuzzleHttp\Client
*/
$tineyeapi = new tineye\api\TinEyeApi($api_key);
$guzzle_client = $tineyeapi->getClient();