<?php

/**
 *
 * @copyright  2025 izend.org
 * @version    2
 * @link       http://www.izend.org
 */

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

function scanfile($login, $password, $file) {
	$curl = 'https://facturalex.com/api/v1/scanfile' . '?' . 'login=' . urlencode($login) . '&' . 'password=' . urlencode($password);

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

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

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

	$r=json_decode($response[2], true);

	if ($r['status'] == 'success') {
		return $r['data']['message_text'];
	}

	return false;
}
