나는 하루 종일이 문제에 대한 답변을 찾고 있습니다. Gmail에 로그인하고받은 편지함을 표시하고 연락처를받는 등 다양한 정보가 있지만 어떻게 가져올 지 알 수 없습니다. 변수 자체로 전자 메일 자체 그래서 나는 PHP로 물건을 할 수 있습니다.cURL을 통해 Gmail 메시지 받기 (PHP)
여기에 내가 가진 무엇 :
function inbox($username, $password){
$url = "https://mail.google.com/mail/feed/atom";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_ENCODING, "");
$curlData = curl_exec($curl);
curl_close($curl);
return $curlData;
}
//calling the function
$em = "[email protected]";
$pw = "pass";
$feed = inbox($em, $pw);
$x = new SimpleXmlElement($feed);
echo "<ul>";
foreach($x->entry as $msg){
//extracting the link to the message from xml
$href = $msg->link->attributes()->href;
//create a link to the message and display title, summary
echo "<li><a href=\"".$href."\">".$msg->title."</a><br />".$msg->summary."</li>";
}
echo "</ul>";
을 지금은 그냥 그냥 Gmail에서 메시지를 열 생성 된 링크를 클릭 할 때. 문자열/변수로 메시지의 html에 액세스하려고합니다. 나는 모든 종류의 것을 시도했다. 나는 다른 페이지로 메일 링크를 전달하려했지만 말아서는 나에게 메시지를 표시하는 대신 구글은 메시지에 또 다른 링크가있는 html을 보낸다. 브라우저에서 링크를 다시 클릭하면 Gmail에서 열립니다. 그러나이 링크에 세 번째로 말리면 빈 페이지가 표시됩니다 ..
나는 의미가 있기를 바랍니다. 요점은 내 작업 서버에 imap/pop이 활성화되어 있지 않으며 cURL이이를 달성 할 수있는 마지막 아는 생각입니다. 어떤 아이디어라도 대단히 감사하겠습니다.