我们在cakephp中通过curl发送xml,但只有电子邮件和电话号码加入 谷歌联系人,其他字段是空白,我们可以得到适当的XML来添加谷歌的所有字段 通过api联系 我们的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;
答案 0 :(得分:1)
我们需要将此标头{{1}}以及授权标头添加到帖子调用中。 这个答案已经是here
答案 1 :(得分:0)
现在这个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'/>
<atom:title>Full Name</atom:title>
<gd:name>
<gd:givenName>CODE1</gd:givenName>
<gd:familyName>Last</gd:familyName>
<gd:fullName>My Name</gd:fullName>
</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" />
EOF;