我们在cakephp中通过curl发送xml,但只添加了电子邮件和电话号码
谷歌联系人,其他字段是空白的,我们可以通过api我们的xml代码获取正确的xml来添加谷歌联系人中的所有字段:
$xml = <<<'EOF'
<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#contact'/>
<title type="text">TITLE</title>
<gd:name>
<gd:givenName>First</gd:givenName>
<gd:additionalName>ADDITIONALNAME</gd:additionalName>
<gd:familyName>Last</gd:familyName>
<gd:namePrefix>NAMEPREFIX</gd:namePrefix>
<gd:nameSuffix>NAMESUFFIX</gd:nameSuffix>
</gd:name>
<gd:structuredPostalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>
<gd:city>CITY</gd:city>
<gd:street>STREET</gd:street>
<gd:region>REGION</gd:region>
<gd:postcode>POSTCODE</gd:postcode>
<gd:country>COUNTRY</gd:country>
</gd:structuredPostalAddress>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home' primary='true'>
HOMEPHONENUMBER
</gd:phoneNumber>\
<gd:phoneNumber rel='http://schemas.google.com/g/2005#mobile'>MOBILENO</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work'>WORKPHONENO</gd:phoneNumber>
<gd:email label="home" address="EMAILADDRESS" displayName="DISPLAYNAME" />
</atom:entry>
EOF;
2 回答
我们需要将此标头
gdata-version: 3.0
以及Authorization标头添加到后调用中 . 这个答案已经here现在这个xml正在运行