$url = 'https://www.google.com/m8/feeds/groups/default/full';
$xml =
'<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xmlns:gd="http://schemas.google.com/g/2005">
<atom:category scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/contact/2008#group"/>
<atom:title type="text">Salsa group</atom:title>
<gd:extendedProperty name="more info about the group">
<info>Nice people.</info>
</gd:extendedProperty>
</atom:entry>
';
$headers = array(
'Host: www.google.com',
'Gdata-version: 3.0',
'Content-length: '.strlen($xml),
'Content-type: application/atom+xml; charset=UTF-8; type=entry',
'Authorization: OAuth '.$accesstoken
);
$xmlresponse = $this->curl($url, $xml, $headers);
echo $xmlresponse; exit;
答案 0 :(得分:3)
面临同样的问题。通过使用以下作为根标记
来实现它<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:gd="http://schemas.google.com/g/2005">
请注意添加的额外属性 - xmlns:atom="http://www.w3.org/2005/Atom"
答案 1 :(得分:1)
我遵循了用于添加新联系人的相同xml结构,它对我有用。这是xml结构:
$xml = '<?xml version="1.0" encoding="utf-8"?> '
.'<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005">'
.'<atom:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#group"/>'
.'<atom:title type="text">Salsa group</atom:title>'
.'<gd:extendedProperty name="more info about the group">'
.'<info>Nice people.</info>'
.'</gd:extendedProperty>'
.'</atom:entry>';
请注意添加的
<?xml version="1.0" encoding="utf-8"?> '
.'<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
答案 2 :(得分:0)
从文档中可以看出,你没有做错任何事。 我确实使用这个XML的批处理URL
来使用它 <feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gContact='http://schemas.google.com/contact/2008'
xmlns:gd='http://schemas.google.com/g/2005'
xmlns:batch='http://schemas.google.com/gdata/batch'>
<entry>
<batch:id>create</batch:id>
<batch:operation type='insert'/>
<atom:category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#group'/>
<title type='text'>CG-Clientes</title>
<gd:extendedProperty name='Just a test'>
<info>DO NOT DELETE</info>
</gd:extendedProperty>
</entry>
</feed>
(注意我替换了&lt; atom:title&gt;只用了&lt; title&gt;,
此更改在批处理中有效,但在常规模式下无效)
到网址https://www.google.com/m8/feeds/groups/default/full/batch
希望这会有所帮助......