Overview › Forums › Discussions › index/reindex and search with API
- This topic has 5 replies, 1 voice, and was last updated 8 months ago by Abbie.
-
AuthorPosts
-
Andreas RottmannGuest
Hy guys
is it possible to run a search like search for “dog” via http or php request and get a response with the search-files and there path?
is it possible to index a folder via php/http? i also need to !reindex! it. For example:
reindex it every day via php/url
thank you
AbbieModeratorHello,Andreas Rottmann.
Please view the Menu->Help->API
Thank you.
Andreas RottmannGuestThank you.
I saw it before, but it won’t work….
I’m not sure, what i should add into “id”. What means 123? is it a example?
thank you
my curl with php got invalid message:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘127.0.0.1:9920’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, “{\n \”id\”: *,\n \”jsonrpc\”: \”2.0\”,\n \”method\”: \”ATRpcServer.Searcher.V1.GetResult\”,\n \”params\”: {\n \”input\”: {\n \”pattern\”: \”Hello\”,\n \”filterDir\”: \”*\”,\n \”filterExt\”: \”*\”,\n \”lastModifyBegin\”: 0,\n \”lastModifyEnd\”: 2147483647,\n \”limit\”: \”300\”,\n \”offset\”: 0,\n \”order\”: 0 /* 0: Default. 1:lastModify ASC. 2:lastModify DESC. 3: filterDir ASC. 3: filterDir DESC. */\n }\n }\n}”);$headers = array();
$headers[] = ‘Accept: application/json’;
$headers[] = ‘Content-Type: application/json’;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);$result = curl_exec($ch);
if (curl_errno($ch)) {
echo ‘Error:’ . curl_error($ch);
}
curl_close($ch);Andreas RottmannGuestsorry, wrong code
this is my test code:
<?php
// Initialize curl session
$curl = curl_init();// Set the URL
curl_setopt($curl, CURLOPT_URL, ‘http://localhost:9920’);// Set the HTTP headers
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
‘Accept: application/json’,
‘Content-Type: application/json’
));// Set the request method to POST
curl_setopt($curl, CURLOPT_POST, true);// Set the request body
$data = array(
“id” => 123,
“jsonrpc” => “2.0”,
“method” => “ATRpcServer.Searcher.V1.GetResult”,
“params” => array(
“input” => array(
“pattern” => “*”,
“filterDir” => “*”,
“filterExt” => “*”,
“lastModifyBegin” => 0,
“lastModifyEnd” => 2147483647,
“limit” => “300”,
“offset” => 0,
“order” => 0 // 0: Default. 1:lastModify ASC. 2:lastModify DESC. 3: filterDir ASC. 3: filterDir DESC.
)
)
);
$data_string = json_encode($data);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);// Return the transfer as a string
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);// Execute curl session
$response = curl_exec($curl);// Close curl session
curl_close($curl);// Output response
echo $response;
?>Andreas RottmannGuestworks now!
Thank you for this great work!!!!!!!!
i need it for my company. Is there any way to see the soruce code? they want to know if it is safe….
AbbieModeratorHello,friend.
Anytxt is very safe , please feel free to use it.
We are sorry that we cannot provide the source code.
-
AuthorPosts