Get a document
getfile
GET https://bezillion.com/api/v1/getfile/id?login=&password=
id is the unique identifier of a file in your index, e.g. 01234567-89ab-cdef-01234-56789abcdef.
| login | Your identification code. |
|---|---|
| password | Your password. |
| text | Returns the text indexed. |
text : 1 - plain text extracted from the document.
IMPORTANT: If the document was indexed with the parameter stored=0, the plain text isn't available.
jumps over
the lazy dog.
Index the file:
$ curl -s --fail --show-error -X POST "https://bezillion.com/api/v1/indexfile?login=abcdef&password=ABCDEF" -F "file=@fox.txt" -o -
{"status":"success","data":{"id":"6e4f9696-4e67-4b2a-afcb-c5d1b0c42430"}}
Note the identifier of the file returned in the field id : 6e4f9696-4e67-4b2a-afcb-c5d1b0c42430.
Get all the fields and the text of file in the index:
$ curl -s --fail --show-error -X DELETE "https://bezillion.com/api/v1/getfile/6e4f9696-4e67-4b2a-afcb-c5d1b0c42430?login=abcdef&password=ABCDEF&text=1"
{"status":"success","data":{id:"6e4f9696-4e67-4b2a-afcb-c5d1b0c42430","file":"fox.txt","size":45,"stored":true,"date":"2026-05-13T11:00:00Z","from":"local","lang":"en","text":"The quick brown fox\njumps over\nthe lazy dog.\n"}}
If the identifier of the file is invalid, the service returns the error HTTP/1.1 400 Bad Request.
If no file in the index matches the specified identifier, the service returns a failure:
{"status":"fail","data":null}
Download the code of the sendget function from the iZend library.
Copy the file in the space of your application.
NOTE: See the page Call the service API for a description of the sendget function.
Add the file getfile.php with the following content:
- require_once 'sendhttp.php';
Loads the code of the sendget function.
- function getfile($login, $password, $id, $text=false) {
Defines the function getfile.
$login is your identification code. $password is your password.
$id is the unique identifier of a file in your index.
If text is true, the text of the file is returned.
- $curl = 'https://bezillion.com/api/v1/getfile/' . urlencode($id);
Sets $curl to the URL of the getfile action of the API with the identifier of the file, the identification code and the password of the user's account.
$login and $password must be escaped.
- $args = array(
- 'login' => $login,
- 'password' => $password,
- 'text' => $text
- );
Prepares the list of arguments of the GET: the identification code and the password of the user's account, whether or not to return the indexed text.
- $response=sendget($curl, $args);
Sends the HTTP request with sendget.
The arguments $id, login and password are already in $curl.
- if (!$response or $response[0] != 200) {
- return false;
- }
If $response is false, the server is unreachable.
If $response[0] doesn't contain the HTTP return code 200 Ok, an execution error has occurred.
In case of error, getfile returns false.
- $r=json_decode($response[2], true);
Decodes the data returned in JSON.
- if ($r['status'] == 'success') {
- return $r['data'];
- }
Returns the result of the search if the action has succeeded.
- $r=json_decode($response[2], true);
Returns false in case of failure.
EXAMPLE
Assuming you have saved the files sendhttp.php and getfile.php in the current directory, run PHP in interactive mode, load the getfile function and call it with as arguments your identification code and password, the id of the file fox.txt in your index:
$ php -a
php > require_once 'getfile.php';
php > $r=getfile('abcdef', 'ABCDEF', '6e4f9696-4e67-4b2a-afcb-c5d1b0c42430');
php > print_r($r);
Array
(
[id] => 6e4f9696-4e67-4b2a-afcb-c5d1b0c42430
[file] => fox.txt
[size] => 45
[stored] => 1
[date] => 2026-05-13T11:00:00Z
[from] => local
[lang] => en
[text] => The quick brown fox
jumps over
the lazy dog.
)
NOTE: If getfile returns false, edit the code to display $response.
SEE ALSO
Call the service API, Index a document, Search for a document

Comments
To add a comment, click here.