示例#1
0
文件: index.php 项目: stdex/ymail
        }
    }
    /*
    var_dump($utm_source);
    var_dump($utm_medium);
    var_dump($utm_campaign);
    var_dump($utm_content);
    var_dump($utm_term);
    */
    $ga_utm = "";
    $datetime = date("d.m.y h:i:s", $header->udate);
    $prettydate = date("jS F Y", $header->udate);
    $timestamp = strval($header->udate);
    $date_file = "messages.txt";
    $date_contains = file_get_contents($date_file, true);
    if (strpos($date_contains, $timestamp) === false) {
        $cnt_new_lead += 1;
        file_put_contents($date_file, $timestamp . "\n", FILE_APPEND);
        send_to_amocrm($name, $phone, $email, $msg, $fertilizer, $volume_fertilizer, $address, $datetime, $utm_source, $utm_medium, $utm_campaign, $utm_content, $utm_term, $ga_utm);
    }
    //var_dump($prettydate);
    if (isset($header->from[0]->personal)) {
        $personal = $header->from[0]->personal;
    } else {
        $personal = $header->from[0]->mailbox;
    }
    $email = "{$personal} <{$header->from[0]->mailbox}@{$header->from[0]->host}>";
    //var_dump($email);
}
imap_close($imap);
echo "Добавлено новых сделок: " . $cnt_new_lead;
    $ea_first_name = $_REQUEST['first_name'];
    $ea_last_name = $_REQUEST['last_name'];
    $ea_middle_name = $_REQUEST['middle_name'];
    $ea_email = $_REQUEST['email'];
    $ea_phone = $_REQUEST['phone'];
    $ea_phone2 = $_REQUEST['phone2'];
    $ea_payed = $_REQUEST['payed'];
    $ea_product_id = $_REQUEST['product_id'];
    $ea_product_name = $_REQUEST['product_name'];
    $ea_product_price = $_REQUEST['product_price'];
    $ea_comments_client = $_REQUEST['comments_client'];
    $ea_organization = $_REQUEST['additional_field_1'];
    $name = $ea_first_name . " " . $ea_last_name . " " . $ea_middle_name;
    $email = $ea_email;
    $phone = $ea_phone;
    $phone2 = $ea_phone2;
    $organization = $ea_organization;
    $lead_title = "Новый лид по: " . $ea_product_name;
    $lead_price = $ea_product_price;
    $lead_comment = $ea_comments_client;
    $utm_source = isset($_REQUEST['utm']) ? $_REQUEST['utm']['utm_source'] : "";
    $utm_medium = isset($_REQUEST['utm']) ? $_REQUEST['utm']['utm_medium'] : "";
    $utm_campaign = "";
    $utm_content = "";
    $utm_term = "";
    send_to_amocrm($name, $email, $phone, $phone2, $organization, $lead_title, $lead_comment, $lead_price, $utm_source, $utm_medium, $utm_campaign, $utm_content, $utm_term, $ga_utm);
}
$req_dump = print_r($_REQUEST, TRUE);
$fp = fopen('request.txt', 'a');
fwrite($fp, $req_dump);
fclose($fp);