File "auth.php"

Full path: /home/kosmetik/public_html/api/honest/auth.php
File size: 1.18 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

function auth_honest()
{
    $url = 'https://honest.ro/web/ap.exe/v2auth.ajax_integrator';
    $login = ['ajax_type' => 'LOGIN', 'val1' => $_REQUEST['username'], 'val2' => $_REQUEST['pass'], 'val3' => '', 'val4' => '', 'val5' => 'Y'];
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $login);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_COOKIEFILE, "honest_cookies.txt");
    curl_setopt($ch, CURLOPT_COOKIEJAR, "honest_cookies.txt");
    $response = curl_exec($ch);
    curl_close($ch);
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_SERVER["CONTENT_TYPE"] == "application/json") {
    $data = trim(file_get_contents("php://input"));
    $json = json_decode($data, true);
    if (is_array($json)) {
        $_REQUEST = $json + $_REQUEST;
    }
    echo auth_honest();
} else {
    http_response_code(405);
}