<?php

/**
 *
 * @copyright  2021-2022 mcpalo.com
 * @version    2
 * @link       http://www.mcpalo.com
 */

require_once 'sendhttp.php';
require_once 'filemimetype.php';

function scancode($login, $password, $file, $yolo=false, $output='file.txt', $params=false) {
	$curl = 'https://tesseractor.com/api/v1/scancode' . '?' . 'login=' . urlencode($login) . '&' . 'password=' . urlencode($password);

	$args = array(
		'yolo'		=> $yolo ? '1' : '0',
	);

	$args = array_merge($args, $params);

	$files=array('file' => array('name' => basename($file), 'tmp_name' => $file, 'type' => file_mime_type($file)));

	$response=sendpost($curl, $args, $files);

	if (!$response or $response[0] != 200) {
		return false;
	}

	return @file_put_contents($output, $response[2]);
}
