The response from the server should be of the following format: <?xml version='1.0' encoding='UTF-8'?> <feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gm='http://base.google.com/ns-metadata/1.0' xmlns:g='http://base.google.com/ns/1.0' xmlns:batch='http://schemas.google.com/gdata/batch'> <id>http://www.google.com/base/feeds/items</id> <updated>2009-06-22T07:49:14.613Z</updated> <title type='text'>Items matching query: [customer id(int):1476186]</title> <link rel='alternate' type='text/html' href='http://base.google.com'/> <link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.google.com/base/feeds/items'/> <link rel='http://schemas.google.com/g/2005#post' type='application/atom+xml' href='http://www.google.com/base/feeds/items'/> <link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='http://www.google.com/base/feeds/items/batch'/> <link rel='self' type='application/atom+xml' href='http://www.google.com/base/feeds/items?start-index=1&max-results=25'/> * <link rel='next' type='application/atom+xml' href='http://www.google.com/base/feeds/items?start-index=26&max-results=25'/> * <author> <name>Google Inc.</name> <email>[email protected]</email> </author> <generator version='1.0' uri='http://base.google.com'>GoogleBase</generator> * <openSearch:totalResults>390</openSearch:totalResults> <openSearch:startIndex>1</openSearch:startIndex> <openSearch:itemsPerPage>25</openSearch:itemsPerPage>* <g:customer_id type='int'>1476186</g:customer_id> <entry> ... </entry> <entry> ... </entry> </feed>
What you're looking for is the bolded line. I can't say how you can obtain that value using the PHP library, but there must be a way to get hold of all links and then find the link with the rel="next". You might find the lines marked with italics useful for your use-case too. For better understanding what the server returns (and not what the library you're using provides), the Google Base API Demo page<http://www.google.com/base/api/demo/html/demo.html>is your friend. Alex On Sun, Jun 21, 2009 at 12:11 AM, doughty <[email protected]>wrote: > > I am trying my best to retrieve all of our product information through > php, and I have finally figured out how to use CURL to ask Google to > show me 250 items at a time, and I am aware of the 'start-index' > paramter which definitely helped me grab more than the initial 250. > > My only dilemma at the moment is being able to tell it when to stop. > Is there a method for querying Google about the total number of items > I have listed in base? > > I was going through the forums here, and somebody noted that in each > request, there is a "next" attribute which gives the next url that I > can curl to gather the next group of items, but I can't find out where > that is actually returned. > > Currently I am using: > > curl_setopt($ch, CURLOPT_URL, $itemsFeedURL . "?max-results=250"); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); > curl_setopt($ch, CURLOPT_HTTPHEADER, array( > 'Content-Type: application/atom+xml', > 'Authorization: AuthSub token="' . trim($token) . '"', > 'X-Google-Key: key=' . $developerKey > )); > $result = curl_exec($ch); > > I can not find the NEXT link in $result anywhere. > > -- > > Either of the two options listed above would seem to solve my issue, > but I obviously need help with one or the other. > > I'm sorry for posting a nubbish question, but this is my first > dabbling in the google api and the documentation here is very > informative, although a little overwhelming I must admit (which is a > good thing). > > As always, any help is appreciated! > > .. and again, sorry for asking for a something that is going to be a > simple solution. > > You are much appreciated and thank you for your time. > > Best, > Doughty > > > -- Alex Dovlecel, Google Switzerland GmbH Company Identifikationsnummer: CH-020.4.028.116-1 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Base Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Base-data-API?hl=en -~----------~----~----~----~------~----~------~--~---
