If your PHP application needs reverse image search data, our PHP quickstart script is the perfect place to start. This script interfaces with the Infringement.Report API to find the websites using specified images, and return them as an array.
We source our data from engines which search based on an image's look and features, meaning that our API finds websites using an image, even if the image has been renamed, resized, or edited.
Pricing for the Infringement.Report API starts at $5 per 1,000 searches, so we beat our competitors on both cost and search quality. Partners optionally get a completely whitelabelled interface, SLA-backed dedicated search infrastructure, and custom analysis on search result or infringing pages.
<?php $payload = array( "apikey" => "YOUR API KEY" "list_label"=>"some identifying string", "images"=> array( "https://www.example.com/images/image.png" // You can have as many images in one search as you like ) ); // First, start a search with the images $result = api( array( "endpoint"=>"/3.0/search", "payload"=>$payload ), "POST" ); $list_id = $result["result"]["list_id"]; $data = array("list_id"=>$list_id); echo "The search request was successful, and the allocated list_id is $list_id<br>\n"; echo "Polling for the search results...<br>\n"; flush(); $search_results = pollForSearchComplete($data); echo "Search complete. The results are: <br>\n"; var_dump($search_results); /////////////////////////////////// // FUNCTIONS USED IN THIS SCRIPT // /////////////////////////////////// function pollForSearchComplete($data){ /* This function will poll the API until all searches are complete. If there are more than 1,000 results, you wil need to paginate through the results. For full API documentation, see https://infringement.report */ $call = api(array("endpoint"=>"/3.0/list/{$data["list_id"]}/query?rows=1000")); $search_has_completed = $call["list"]["search_in_progress"] > 0; if($search_has_completed){ return $call; }else{ sleep(5); $try_again = pollForSearchComplete($data); return $try_again; } } function api($data,$method="GET"){ $postarr = array( 'method' => $method, 'header' => 'X-API-KEY: '.$data["apikey"] ); if(in_array($method,array("POST","PATCH"))){ $postarr["content"] = json_encode( $data["payload"] ); } $opts = array('http' => $postarr ); $url = "https://api.infringement.report".$data["endpoint"]; $context = stream_context_create($opts); $content = file_get_contents($url, false, $context); $ret = json_decode($content,true); return $ret; } ?>
{ "status": true, "result": { "query_result": { "numFound": 8315, "start": 0, "docs": [ { "result_hash": "36f9ed88cad83d826dc3472714ea7a49", "id": "36f9ed88cad83d826dc3472714ea7a49", "title": "Pin by Love Remodeled | Saving Money, DIY, Farmhouse Style ...", "description": "Stella Artois Bar - LED neon light sign made of the premium quality transparent plastic and bright colorful LED illumination. The neon sign displays exactly the ...", "url": "https://www.pinterest.com/pin/322077810845658503/", "host": "pinterest.com", "image_url": "https://i.pinimg.com/originals/fc/1a/2a/fc1a2a246f80c04a7d5f13a8d6c203f6.jpg", "search_image_url": "https://s3.us-east-2.amazonaws.com/infringementreport/18051/c67d644788494df86c7449fb080bf7e7-figure-freedom.jpg", "malicious": false, "language": "en", "protocol": "https", "image_width": 735, "image_height": 1602, "image_height_on_page": 332, "image_width_on_page": 152, "found_timestamp": "2018-07-14T01:45:02Z", "user_id": 246, "list_id": 18051, "image_id": 182291 }, { "result_hash": "428feb42443e852259f914414ddbd17a", "id": "428feb42443e852259f914414ddbd17a", "title": "Jacqueline Ann Clark - Commercial Property Manager - Suffolk Life ...", "description": "View Jacqueline Ann Clark's profile on LinkedIn, the world's largest professional community. Jacqueline Ann has 13 jobs listed on their profile. See the complete ...", "url": "https://uk.linkedin.com/in/jacqueline-ann-clark-bb412724", "host": "uk.linkedin.com", "image_url": "https://media.licdn.com/media-proxy/ext%3Fw%3D800%26h%3D800%26hash%3DVZhisDJRaB2oV3Dl4Mhjv%252F%252FLxfg%253D%26ora%3D1%252CaFBCTXdkRmpGL2lvQUFBPQ%252CxAVta5g-0R6nlh8Tw1It6a2FowGz60oISIfYC2G8G2f1spyfNT-tdoDSeLKhpEtOdS0BkAQkKeL2VmiwUcuxXMyUdaMwjOORUPfiNzMiSwUfsD1638YOaxEN8MeCQ-TiYXMfl757bAmfEI3RY1kNBzUQ0b6FO7btD38h6BPebsDAL9hEB5JwoLRxjlVS__nSIZsokNsn_XpPmg_lrb3dBDcJ2LScNBeMIFQgGzDoAtEUtLys_x6ylVLwnRHe_76TLf2KH6MVnXGt_vX9JC-JryFftEwDzhcc39InU1nwhP8l5E6eO_4tXTuF4LG3X3r4wYYA_i0LtZauNRmVdDJjvg19fcmD7mY0IofY9i_O4BNtWoh4Tkh6lePAfPavjUmLcXtLYXybRAZOpcbJmfSlJIVnSuZfnNhgTJ4WJTZLcNEZbCHxzOQ1CgFnoKILYQe9ZDnutZL5a_U0cM9WKFBRd7Ta", "search_image_url": "https://s3.us-east-2.amazonaws.com/infringementreport/18051/c67d644788494df86c7449fb080bf7e7-figure-freedom.jpg", "malicious": false, "language": "en", "protocol": "https", "image_width": 800, "image_height": 800, "image_height_on_page": 225, "image_width_on_page": 225, "found_timestamp": "2018-07-14T01:45:02Z", "user_id": 246, "list_id": 18051, "image_id": 182291 }, { "result_hash": "0fc9c1bf723f00221abaca8b3b29388e", "id": "0fc9c1bf723f00221abaca8b3b29388e", "title": "Images about #MyUndi tag on instagram", "description": "#Repost @passarawak (@get_repost) ・・・ Adab Berkempen Pilihanraya. . . 1. Betulkan niat berkempen kerana Allah untuk mendapat keredhaanNya dan moga ...", "url": "http://www.pictame.com/tag/MyUndi", "host": "pictame.com", "image_url": "https://scontent-sea1-1.cdninstagram.com/vp/707fd7f617c9da9015f0e3d663871143/5B68F247/t51.2885-15/s480x480/e35/30592431_2104587419558413_720325122879127552_n.jpg%3Fig_cache_key%3DMTc1NzM4ODczMjM3NTIzNzY0OQ%253D%253D.2", "search_image_url": "https://s3.us-east-2.amazonaws.com/infringementreport/18051/c67d644788494df86c7449fb080bf7e7-figure-freedom.jpg", "malicious": false, "language": "ms", "protocol": "http", "image_width": 480, "image_height": 480, "image_height_on_page": 225, "image_width_on_page": 225, "found_timestamp": "2018-07-14T01:45:02Z", "user_id": 246, "list_id": 18051, "image_id": 182291 } ] }, "facets": null, "facet_ranges": null, "list": { "list_label": "Example Image Search List", "last_result_search": 1550201533, "monitor": true, "last_monitored": 1550201461, "list_id": 18051, "count": 1, "search_in_progress": 0, "search_complete": 1, "unique_hosts": 2153, "unique_pages": 8215, "last_searched": null, "source_images_found": 2 }, "resolved_tags": [ { "tag_label": "Approved", "colour": "79e524", "alias_of": "approved", "state": "live", "tag_id": "approved" }, { "tag_label": "Send to lawyer", "colour": "0311b6", "alias_of": null, "state": "live", "tag_id": 79 }, { "tag_label": "Unapproved", "colour": "deda27", "alias_of": "unapproved", "state": "live", "tag_id": "unapproved" }, { "tag_label": "Investigate", "colour": "24e590", "alias_of": "investigate", "state": "live", "tag_id": "investigate" }, { "tag_label": "Follow Up", "colour": "db6b06", "alias_of": "followup", "state": "live", "tag_id": "followup" }, { "tag_label": "Trash", "colour": "ff131a", "alias_of": "trash", "state": "live", "tag_id": "trash" } ] } }