Search code examples
phpzend-frameworkgoogle-contacts-api

ZendFramework Contact Query


I am using the following

  // perform query and get feed of all results
  $query = new Zend_Gdata_Query(
    'http://www.google.com/m8/feeds/contacts/default/full');
  $query->maxResults = 1000;
  $query->setParam('sortorder', 'descending');
  $feed = $gdata->getFeed($query);

To retrieve a specific user's contacts. However I want this to be ordered by name, how is this possible? I was trying something like this however it does not seem to work.

      $query->setParam('orderby', 'name');

Solution

  • Well, I actually am getting a 401 error with that URL, but assuming it worked you would have to check with google to see what params can be sent - if any - to sort the results by a certain criteria. The setParam() function you're seeing is merely setting GET params such that the actual full URL being sent to google is this:

    http://www.google.com/m8/feeds/contacts/default/full?max-results=1000&sortorder=descending

    All you need to do is find out from Google the correct parameter name to set the "sort by" field.