2
Zend 프레임 워크에 문제가 있습니다. Google의 서버에서 단일 연락처를 삭제하려고합니다.Zend GData - Google 연락처를 삭제할 수 없습니다. - Etag 오류
class GContacts
{
const BASE_FEED_URI = 'https://www.google.com/m8/feeds';
private $client = NULL;
private $gData = NULL;
private $contScope = '';
private $groupScope = '';
public function __construct($userName,$pass){
ini_set('include_path', LIB_DIR);
require_once('\Zend\Loader.php');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_Feed');
$this -> client = Zend_Gdata_ClientLogin::getHttpClient($userName, $pass, 'cp');
$this -> gData = new Zend_Gdata($this -> client);
$this -> gData -> setMajorProtocolVersion(3);
$this -> contScope = self :: BASE_FEED_URI . '/contacts/' . urlencode($userName);
}
public function addContact($cont){
$doc = new DOMDocument();
$doc -> formatOutput = true;
// header
$entry = $doc -> createElement('atom:entry');
$entry -> setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:atom', 'http://www.w3.org/2005/Atom');
$entry -> setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:gd', 'http://schemas.google.com/g/2005');
$entry -> setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:gContact', 'http://schemas.google.com/contact/2008');
$doc -> appendChild($entry);
// add name element
$name = $doc -> createElement('gd:name');
$entry -> appendChild($name);
$fullName = $doc -> createElement('gd:fullName', 'John Doe');
$name -> appendChild($fullName);
// insert entry
$addResult = $this -> gData -> insertEntry($doc -> saveXML(), 'http://www.google.com/m8/feeds/contacts/default/full');
return $this -> parseUniqueId($addResult -> id);
}
public function delete($gid){
// Should be some work with Etag, but Zend is buggy and it doesn't work
$entry = $this -> gData -> getEntry($this -> contScope . '/full/' . $gid);
$entry -> delete();
}
private function parseUniqueId($link){
$arr = explode('/',$link);
return end($arr);
}
}
그리고 전화 : 여기
$gCont = new GContacts($userName,$pass);
$gid = $gCont -> addContact('param will be soon');
$gCont -> delete($gid);
(삭제 방법) 문제이다 : 나는 클래스가
- 예상 응답 코드 (200), 도착 403의 If-일치하는 경우 일치하지 않는 헤더 또는 항목의 etag 속성이 필요합니다.
Google를 사용해야합니다.,이 연락처에 액세스 할 수있는 사람이 두 명 이상이므로 Zend bugreport에서 this 또는 조언 here을 사용할 수 없습니다. 아무도 그것을 해결하는 방법을 생각해?
고맙습니다. Ajax
EDIT :이 버그는 전혀 수정되지 않았습니다.이 문제가있는 사람이 있습니까? 나는 필사적이야 .. :(
안녕하세요.! 귀하의 답변에 감사드립니다. Google 연락처가있는이 프로젝트는 건너 뜁니다. 지금은 아주 다른 무언가를 연구하고 있으며 테스트 할 수 없습니다. 하지만 네 답에 감사 드리니, 나는 네가 미래에 그것을 할거야. – Ajax