Google API를 통해 사용자로부터 모든 이메일을받는 데 cURL을 사용하고 있습니다. 다음은 https://developers.google.com/admin-sdk/email-audit/#retrieving_all_email_monitors_of_a_source_user입니다.CURL - get Google API에서 모든 이메일 검색
이 자습서에 따르면 서버는 '201 Created'상태 코드를 성공적으로 반환합니다. 하지만 내 결과는 '200 OK'코드를 반환합니다. 여기
코드 인증
$data = array(
'accountType' => 'HOSTED_OR_GOOGLE',
'Email' => 'myEmail',
'Passwd' => 'myPassword',
'source'=>'PHP-cUrl-Example',
'service'=>'apps');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/accounts/ClientLogin");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
입니다 그리고 여기에 모든 이메일 소스 사용자의 모니터
preg_match("/Auth=([a-z0-9_-]+)/i", $response, $matches);
$auth = $matches[1];
$header = array('Content-Type: application/atom+xml; charset=utf-8',
'Authorization: GoogleLogin auth='.trim($auth),
);
$url_email ="https://apps-apis.google.com/a/feeds/compliance/audit/mail/monitor/mydomain/username";
curl_setopt($ch, CURLOPT_URL, $url_email);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
$response = curl_exec($ch);
$response = simplexml_load_string($response);
curl_close($ch);
print_r($response);
이 pls는 저에게 도움말을 가져 오는 코드를 무엇입니까?
모든 이메일 모니터를 검색 할 때 어떤 결과가 나타 납니까? 거기서 만든 건가요? – Emily
@EmilyLam : 모든 전자 메일 모니터에 대한 항목 요소가없는 AtomPub 피드를 반환합니다. –