Set Filter Issue with Webmaster Service - Google API PHP V3 -
i'm working webmaster tools api v3 queries search console. script works great: login works , when request queries result correct. need set filters queries tablet devices. how can this? code is:
$request = new google_service_webmasters_searchanalyticsqueryrequest; $request->setstartdate('2015-06-03'); $request->setenddate('2015-06-09'); $request->setdimensions(array('query')); $request->setrowlimit("5"); $filter = new google_service_webmasters_apidimensionfilter; $filter->setdimension("device"); $filter->setoperator("equals"); $filter->setexpression("tablet"); $filters = new google_service_webmasters_apidimensionfiltergroup; $filters->setfilters($filter); $request->setdimensionfiltergroups($filters); $request->setsearchtype("web"); $qsearch = $searchanalytics->query("http://www.****.**", $request);
i've tried create 2 object (google_service_webmasters_apidimensionfilter , google_service_webmasters_apidimensionfiltergroup) , used pass filter parameters. when print_r $qsearch result equal queries without filter. don't know if right way, because there isn't specific reference.
i used api explorer review parameters, using results , parameters correct.
any idea?
thanks
as far can see, need add array arguments couple of set parameters. works fine me.
$filters->setfilters(array($filter)); $request->setdimensionfiltergroups(array($filters));
Comments
Post a Comment