<?php
$limit = 6;

$new_ = generateMail();
/***********************************
USE $new_->username AS E-MAIL ADDRESS FOR YOUR AUTOMATION
***********************************/
$mail = checkMails($new_->password, $limit); //Checking Inbox
echo $mail->body;

function generateMail() {
    global $ch;

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://106.scripts.qu.web.tr/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://106.scripts.qu.web.tr/login");
    curl_setopt($ch, CURLOPT_POSTFIELDS, array("key" => $password));
    curl_exec($ch);

    curl_setopt($ch, CURLOPT_URL, "https://106.scripts.qu.web.tr/checkInbox");
    curl_setopt($ch, CURLOPT_POSTFIELDS, array());
    $output = json_decode(curl_exec($ch));
    
    if($output)
        return $output[0];

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