skishore119 / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
0 stars 0 forks source link

Search Image #386

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello I'm using the library, and I'm trying to do a search only images. I 
inserted a generic term in the script but can not find anything. What should I 
do?

require_once dirname(__FILE__).'/libs/src/Google_Client.php';
require_once 
dirname(__FILE__).'/libs/src/contrib/Google_CustomsearchService.php';

session_start();
$scriptUri = "http://".$_SERVER["HTTP_HOST"].$_SERVER['PHP_SELF'];

$client = new Google_Client();
$client->setApplicationName('Cerca');
//$client->setClientId('834496611770-fdmuo8jb76ag72uifm6k92ufd5uduhjr.apps.googl
eusercontent.com');
//$client->setClientSecret('clgn5LCSesdKg689iHcdxU0e');
//$client->setRedirectUri($scriptUri);
$client->setDeveloperKey('####'); // API key

// $service implements the client interface, has to be set before auth call
$service = new Google_CustomsearchService($client);
$service->__call("searchType","image");
$result = $service->cse->listCse('naruto', array(
  'cx' => '######', // The custom search engine ID to scope this search query.
  'searchType' => 'image'
));
print "<pre>" . print_r($result, true) . "</pre>";

// Example executing a search with the URL of a linked custom search engine.
//$result = $service->cse->listCse('naruto', array(
//  'cref' => 'http://www.google.com/cse/samples/vegetarian.xml',
//));
//print "<pre>" . print_r($result, true) . "</pre>";

Original issue reported on code.google.com by htcmi...@gmail.com on 1 Sep 2013 at 8:58

GoogleCodeExporter commented 8 years ago
You might get a quick response on this asking the custom search team as they 
have more API specific knowledge: https://developers.google.com/custom-search/

Original comment by ianbar...@google.com on 2 Sep 2013 at 8:41

GoogleCodeExporter commented 8 years ago
This issue tracker is now closing. Development on the Google PHP client library 
moved to GitHub with the release of the 1.0.0-alpha, and now the 1.0 branch has 
reached beta status there will be no further releases of the 0.6 branch of the 
library. 

Please take a look at the latest version on 
https://github.com/google/google-api-php-client

For information on migrating, please take a look at this guide: 
https://developers.google.com/api-client-library/php/guide/migration

For general library support please ask a question on StackOverflow: 
http://stackoverflow.com/questions/tagged/google-api-php-client

If you are looking for support with a specific API, please contact the team 
working with that API via StackOverflow or their preferred support mechanism. 

If your issue still exists with the new version of the library, please raise a 
bug in the GitHub issue tracker with a minimal code sample. 

Thanks!

Original comment by ianbar...@google.com on 22 Jan 2014 at 4:53