Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $param = '{ "size": 0, "aggs":{ "max_id":{ "max": { "field": "user_id" } } } }'; $header = array("content-type: application/json; charset=UTF-8"); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://" . "172.17.115.16" . ":9200/index_users_thor/_search"); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_POSTFIELDS, $param); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_USERPWD, "elastic" . ":" . "123456789"); $res = curl_exec($curl); curl_close($curl); $resJSON = json_decode($res);
Copy Clear