【发布时间】:2013-12-24 12:44:43
【问题描述】:
我们在 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;
【问题讨论】:
-
很高兴你能改进 xml 我知道代码是一样的,但它没有在谷歌联系人中添加人的姓名和地址
-
检查这里 - This post has the answer
标签: xml cakephp google-api google-contacts-api google-api-php-client