Google 연락처 API를 사용하고 있으며 이름과 이메일 주소, 전화 번호, 이미지를 추출 할 수 있지만 연락 주소, 메모 및 인증하는 동안 내가 PHP를 사용하고Google 연락처 API 연락처 세부 정보 (PHP)
또한 직장이나 집으로 이메일을 추출하는 방법과 여기에 내 코드는 다음과 같습니다
$document = new DOMDocument();
$document->loadXml($xmlresponse);
$xpath = new DOMXpath($document);
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
$xpath->registerNamespace('gd', 'http://schemas.google.com/g/2005');
foreach ($xpath->evaluate('/atom:feed/atom:entry') as $entry) {
$contact = [
'name' => $xpath->evaluate('string(atom:title)', $entry),
'image' => $xpath->evaluate('string(atom:link[@rel="http://schemas.google.com/contacts/2008/rel#photo"]/@href)', $entry),
'emails' => [],
'numbers' => [],
'conatctaddress' => []
];
foreach ($xpath->evaluate('gd:email', $entry) as $email) {
$contact['emails'][] = $email->getAttribute('address');
}
foreach ($xpath->evaluate('gd:phoneNumber', $entry) as $number) {
$contact['numbers'][] = trim($number->textContent);
}
}
어떻게 연락처 주소를 가져올 수 있습니다. 그들 (구글 API)는 formattedAddress, structuredPostalAddress 언급하지만 인출하는 방법을 해달라고하고 또한 가정의 경우 찾거나 내가 XML 응답을 받고 있어요 답변을 아래에서 언급하지만 응답이 완료되지 않은 것처럼
편집
작동합니다. 이 세부 사항도
https://www.google.com/m8/feeds/contacts/default/full?&oauth_token=abcdferyyrfyfyt
과를 통해 인출되지 않도록 연락처는 생일, 기념일, 웹 사이트의 세부 사항을 포함하기 때문에 점점 나머지 데이터 메신저는 내가 이메일 동일하게 foreach loop
을 시도 이것에 대한 너무
<gd:organization rel='http://schemas.google.com/g/2005#other'><gd:orgName>comright</gd:orgName><gd:orgTitle>software developer</gd:orgTitle></gd:organization>
로 0 orgName
및 orgTitle
을 하나의 변수로 가져 오기
위의 url을'https : //www.google.com/m8/feeds/contacts/default/full? & oauth_token = 1234567894'로 사용하면 XML 응답을 얻지 만 완전한 응답을 가져 오지 못합니다. 예를 들어 나는 –
software