Is curl_exec failing silently?

You may have to (un)set some additional options:
http://us.php.net/manual/en/function.curl-setopt.php

Eric

On Oct 8, 2:49 pm, deandail <[EMAIL PROTECTED]> wrote:
> > If there's errors, the response body will contain an error message
> > like your example:
>
> But alas, it does not. When the insertion works, I get a copy of the
> created fields. When the insertion does not work, I get no response at
> all.
>
> (to clarify, I know that it doesn't work, because the program is
> written so that when insertion doesn't work it tells me "Insertion
> failed". I get that response. But I don't get the server response that
> indicates what the error was.)
>
> On Oct 7, 5:40 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
>
> > On Oct 6, 12:45 pm, deandail <[EMAIL PROTECTED]> wrote:
>
> > > Right. That is the server's response, and that is what I would like it
> > > to show me. However, it does not show me that. I know that that is the
> > > server's response because when I use the API Demo page 
> > > here,http://www.google.com/base/api/demo/html/demo.htmlthatisthe
> > > response it shows.
>
> > > The code that you suggested in order to see that response in my own
> > > program was
> > > echo '<pre>' . $result . '</pre>';  // result will contain the
> > > server's response
>
> > > However, that code does not contain the server's response, or at least
> > > not the response that I'm referring to. It contains the fields that I
> > > submitted, in addition to the created fields (id and date created). It
> > > doesn't tell me anything about errors or really anything useful.
>
> > On a successful insertion, the server will return the created entry as
> > the response.
> > If there's errors, the response body will contain an error message
> > like your example:
> > <errors>
> >   <error type="data" field="serving_count" reason="This entry is not
> > of type number. Example: 1,000 for one thousand." />
> > </errors>
>
> > Eric
>
> > > On Oct 3, 5:07 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
>
> > > > In this case, that _is_ the server's response.
> > > > It looks like you may be inserting a null
> > > > value for the serving_count attribute.
> > > > Perhaps you're leaving that field blank
> > > > when hitting submit?
>
> > > > > How can I see that response?
>
> > > > > Thanks!
> > > > > DeAnna
>
> > > > > On Oct 2, 3:46 pm, "Eric (Google)" <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi deandail,
>
> > > > > > To point the link to your own site the format is:
> > > > > > <link rel='alternate' type='text/html' 
> > > > > > href='http://ENTER-YOUR-URL'/>
>
> > > > > > (The important part is the rel='alternate')
>
> > > > > > Viewing the response from the Google Base server will
> > > > > > depend on how you're submitting the data.  The php4 sample
> > > > > > you mentioned uses libcurl, so I would use that to echo the result
> > > > > > of the curl_exec():
>
> > > > > > $result = curl_exec($ch);  /* Execute the HTTP command. */
> > > > > > curl_close($ch);
> > > > > > echo '<pre>' . $result . '</pre>';  // result will contain the
> > > > > > server's response
>
> > > > > > Eric
>
> > > > > > On Oct 2, 1:16 pm, deandail <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Thanks celebird,
>
> > > > > > > Maybe I don't understand how the ftp route works, but I didn't 
> > > > > > > think
> > > > > > > it did what I want.
>
> > > > > > > Specifically, we have around 18,000 products. Right now, I use a 
> > > > > > > mySQL
> > > > > > > query to download that into a csv file, which I upload manually to
> > > > > > > Base once a month. There are two problems with that:
>
> > > > > > > 1) It takes me a fair amount of time to configure the file 
> > > > > > > correctly,
> > > > > > > and future holders of this position likely won't know how to do 
> > > > > > > that.
>
> > > > > > > 2) (And the much bigger issue) We sell and receive product every 
> > > > > > > day,
> > > > > > > so by the end of the month our Base inventory is sadly out of 
> > > > > > > date. We
> > > > > > > see our bounce rates increase steadily over the course of the 
> > > > > > > month as
> > > > > > > people more often click on something in Base that we don't 
> > > > > > > actually
> > > > > > > have in our online store.
>
> > > > > > > 3) (not a problem per se, but to be noted) It takes Base a couple 
> > > > > > > days
> > > > > > > to make searchable an upload with several thousand products in it.
>
> > > > > > > So I could just upload the spreadsheet more often in order to 
> > > > > > > make it
> > > > > > > more accurate, say once a week instead of once a month, and I 
> > > > > > > could
> > > > > > > even automate that via FTP. But I don't want our full inventory 
> > > > > > > to be
> > > > > > > unsearchable for 2 days out of every week.
>
> > > > > > > What I want to do is insert new products and delete products that 
> > > > > > > we
> > > > > > > no longer have in stock each day without re-uploading the full
> > > > > > > inventory. The insertions and deletes would only total around a 
> > > > > > > dozen
> > > > > > > or couple dozen changes a day. My understanding is that the FTP 
> > > > > > > feed
> > > > > > > needs to have the same name each time in order for it to be 
> > > > > > > automated,
> > > > > > > therefore overwriting the previous file. So if I have a feed where
> > > > > > > I've uploaded all 18,000 items, and then I send a subsequent file 
> > > > > > > with
> > > > > > > just a few updates, it will overwrite the whole previous file, 
> > > > > > > leaving
> > > > > > > me with only those updated items in Base.
>
> > > > > > > Do I misunderstand how the ftp process works? Or is some version 
> > > > > > > of
> > > > > > > the API system what I need in order to do what I want?
>
> > > > > > > If the API is what I need, then here are the answers to your other
> > > > > > > questions.
> > > > > > > I am right now just doing single item entries until I figure out 
> > > > > > > how
> > > > > > > the process works. In the future I will use the batch feature to 
> > > > > > > send
> > > > > > > two separate requests: insert new items, delete sold items.
>
> > > > > > > The example code I started with can be found 
> > > > > > > herehttp://code.google.com/apis/base/samples/php/php-sample.html
>
> > > > > > > The two pieces of that sample that I have changed have been the
> > > > > > > function to build the insert xml and here is my version of that 
> > > > > > > piece
> > > > > > > function buildInsertXML() {
> > > > > > > $result = "<?xml version='1.0'?>" . "\n";
> > > > > > > $result .= "<entry xmlns='http://www.w3.org/2005/Atom'" . "
> > > > > > > xmlns:g='http://base.google.com/ns/1.0'>" . "\n";
> > > > > > > $result .= "<category scheme='http://base.google.com/categories/
> > > > > > > itemtypes'" . " term='Products'/>" . "\n";
> > > > > > > $result .= "<title type='text'>" . $_POST['title'] . "</title>" .
> > > > > > > "\n";
> > > > > > > $result .= "<g:item_type>Products</g:item_type>" . "\n";
> > > > > > > $result .= "<g:price>" . $_POST['price'] . "</g:price>" . "\n";
> > > > > > > $result .= "<id>" . $_POST['id'] . "</id>" . "\n";
> > > > > > > $result .= "<g:image_link>" . $_POST['image_link'] . "</
> > > > > > > g:image_link>" . "\n";
> > > > > > > $result .= "<link href='".$_POST['link']."'". "/>" . "\n";
> > > > > > > $result .= "<content>" . $_POST['description'] . "</content>" . 
> > > > > > > "\n";
> > > > > > > $result .= "</entry>" . "\n";
> > > > > > >   return $result;
>
> > > > > > > And then I've updated the form where a user manually inputs the
> > > > > > > content for those fields, so that I can test and make sure I've 
> > > > > > > got it
> > > > > > > all formatted correctly before I switch to a batch setup. That 
> > > > > > > piece
> > > > > > > of code I've modified to this
> > > > > > > /**
> > > > > > >  * Prints a small form allowing the user to insert a new
> > > > > > >  * recipe.
> > > > > > >  */
> > > > > > > function showRecipeInsertPane($token) {
> > > > > > >   global $cuisines;
> > > > > > >   print '<td valign="top" width="50%">' . "\n";
> > > > > > >   print '<table width="100%">' . "\n";
> > > > > > >   print '<tr><th colspan="2" style="text-align:center">Insert a 
> > > > > > > new
> > > > > > > recipe</th></tr>' . "\n";
> > > > > > >   print '<form method="post" action="' . $_SERVER['PHP_SELF'] . 
> > > > > > > '">' .
> > > > > > > "\n";
> > > > > > >   print '<input type="hidden" name="action" value="insert">' . 
> > > > > > > "\n";
> > > > > > >   print '<input type="hidden" name="token" value="' . $token . 
> > > > > > > '">' .
> > > > > > > "\n";
> > > > > > >   print '<tr><td align="right">Title:</td>' . "\n";
> > > > > > >   print '<td><input type="text" name="title" class="half">' . 
> > > > > > > '</td></
> > > > > > > tr>' . "\n";
> > > > > > >   print '<tr><td align="right">Type</td>' . "\n";
> > > > > > >   print '<td><input type="text" name="product_type" 
> > > > > > > class="half">' .
> > > > > > > '</td></tr>' . "\n";
> > > > > > >  print '<tr><td align="right">Price</td>' . '<td><input 
> > > > > > > type="number"
> > > > > > > name="price">&nbsp;' . '</td></tr>' . "\n";
> > > > > > >  print '<tr><td align="right">ID</td>' . '<td><input type="number"
> > > > > > > name="id">&nbsp;' . '</td></tr>' . "\n";
> > > > > > > print '<tr><td align="right">Image Link</td>' . "\n";
> > > > > > > print '<td><input type="text" name="image_link"></td></tr>' .  
> > > > > > > "\n";
> > > > > > >   print '<tr><td align="right">link</td>' . "\n";
> > > > > > >   print '<td><input type="text" name="link"></td></tr>' . "\n";
> > > > > > >   print '<tr><td align="right">Description</td>' . "\n";
> > > > > > >   print '<td><textarea class="full" 
> > > > > > > name="description"></textarea></
> > > > > > > td></tr>' . "\n";
> > > > > > >   print '<td>&nbsp;</td><td><input type="submit" value="Submit"></
> > > > > > > td>' . "\n";
> > > > > > >   print '</form></tr></table>' . "\n";
> > > > > > >   print '</td>' . "\n";
>
> > > > > > > }
>
> > > > > > > In the first block, here is the one line that references the link
> > > > > > > attribute
> > > > > > > $result .= "<link href='".$_POST['link']."'". "/>" . "\n";
> > > > > > > and that url is currently being input by hand in the insert form. 
> > > > > > > The
> > > > > > > url is accepted, but doesn't attach itself to the item the same 
> > > > > > > way it
> > > > > > > does if I enter a link in the csv file. The item isn't linked to 
> > > > > > > our
> > > > > > > site.
>
> > > > > > > On Oct 2, 11:46 am, Celebird <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > the google-base-api isn't needed to upload a feed-file;
> > > > > > > > you can simply invoke ftp.
>
> > > > > > > > i believe tom's suggestion is not to use the google-base api
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to