So here's the frustratingly non-apparent solution.  For some reason
whatever Google uses to parse the xml reaches the end of the file
before it sees the closing tag.  By random happenstance (and
desperation) I tried adding the newline character to the end of the
xml "\n\n" and it worked like a champ!


On Sep 8, 9:37 am, Steve <[email protected]> wrote:
> I am using the following code to try to create a contact with PHP:
>
> $xmldata =
>                 "<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
> xmlns:gd='http://schemas.google.com/g/2005'xmlns:gContact='http://
> schemas.google.com/contact/2008'>
>         <atom:category scheme='http://schemas.google.com/g/2005#kind'
> term='http://schemas.google.com/contact/2008#contact'/>
>         <gd:name>
>                 <gd:fullName>steve kneelsun</gd:fullName>
>         </gd:name>
>         <gd:email rel='http://schemas.google.com/g/2005#work'primary='true'
> address='[email protected]' displayName='steve kneelsun' />
>         <gContact:groupMembershipInfo href='http://www.google.com/m8/feeds/
> groups/default/base/42a7cb608a6da0e0' />
> </atom:entry>";
>
>                 $header_array[0]="Content-Type: application/atom+xml";
>                 $header_array[1]="Content-Length: " . strlen($xmldata);
>                 $header_array[2]="Authorization: GoogleLogin auth=". $token;
>
>                 $ch = 
> curl_init('http://www.google.com/m8/feeds/contacts/orders
> %40childrensmiraclemusic.com/full');
>                 curl_setopt($ch, CURLOPT_HTTPHEADER, $header_array);
>                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
>                 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
>                 curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
>                 curl_setopt($ch, CURLOPT_POST, 1);
>                 curl_setopt($ch, CURLOPT_POSTFIELDS, $xmldata);
>                 $response = curl_exec($ch);
>                 curl_close($ch);
>
>                 echo $response;
>
> And consistently get the following response:
>
> The element type "atom:entry" must be terminated by the matching end-
> tag "</atom:entry>".
>
> My XML looks like it is formed well, and since curl is connecting at
> all, I figure the connection is sound.  What could be producing this
> error?  Do I need to change something in my XML?  Any suggestions
> would be helpful.  Cheers!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Contacts 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-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to