API

API

<?php
$limit = 6; // gelen e-posta deneme sayısı

$new_ = generateMail();
// $new_->username ile e-posta adresini kullanabilirsiniz.
$mail = checkMails($new_->password, $limit);
echo $mail->body;

function generateMail() {
global $ch;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://geciciemail.com/generateNew");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array());
$output = json_decode(curl_exec($ch));

return (object) array(
"username" => $output->address,
"password" => $output->recover_key
);
}

function checkMails($password, $limit) {
global $ch;

if($limit <= 0)
return null;

sleep(10);

curl_setopt($ch, CURLOPT_COOKIEJAR, "coookie.txt");
curl_setopt($ch, CURLOPT_URL, "https://geciciemail.com/login");
curl_setopt($ch, CURLOPT_POSTFIELDS, array("key" => $password));
curl_exec($ch);

curl_setopt($ch, CURLOPT_URL, "https://geciciemail.com/checkInbox");
curl_setopt($ch, CURLOPT_POSTFIELDS, array());
$output = json_decode(curl_exec($ch));

if($output)
return $output[0];

$limit--;
return checkMails($password, $limit);
}
?>