-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.php
More file actions
48 lines (35 loc) · 1.32 KB
/
example.php
File metadata and controls
48 lines (35 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require_once 'vendor/autoload.php';
//create unplag client
$unplag = new Unplag\Unplag('YOUR-API-KEY', 'YOUR-API-SECRET');
//upload file
$testText = <<<EOF
PHP code may be embedded into HTML code, or it can be used in combination with various web template systems, web content management systems and web frameworks.
PHP code is usually processed by a PHP interpreter implemented as a module in the web server or as a Common Gateway Interface (CGI) executable.
The web server combines the results of the interpreted and executed PHP code, which may be any type of data, including images, with the generated web page.
PHP code may also be executed with a command-line interface (CLI) and can be used to implement standalone graphical applications.
EOF;
try
{
$file = $unplag->fileUpload(\Unplag\PayloadFile::bin($testText), 'txt');
}
catch (Unplag\Exception\UnplagException $e)
{
echo $e;
die('File upload error: ' . $e->getMessage() . PHP_EOL);
}
echo 'File uploaded!' . PHP_EOL;
var_dump($file);
//start check
$checkParam = new \Unplag\Check\CheckParam($file['id']);
$checkParam->setType(\Unplag\Check\CheckParam::TYPE_WEB);
try
{
$check = $unplag->checkCreate($checkParam);
}
catch (Unplag\Exception\UnplagException $e)
{
die('Check start fail: ' . $e->getMessage() . PHP_EOL);
}
echo 'Check started!' . PHP_EOL;
var_dump($check);