Overview › Forums › Discussions › index/reindex and search with API › Reply To: index/reindex and search with API
sorry, 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;
?>