```$booksSchema = array(); $booksSchema['n...
# community-help
f
Copy code
$booksSchema = array();
        $booksSchema['name'] = 'property_residentials';
        $booksSchema['fields'] = array();
        $t = array();
        $t['name'] = 'property_id';
        $t['type'] = 'int32';
        array_push($booksSchema['fields'], $t);
        $t = array();
        $t['name'] = 'AcresTotal';
        $t['type'] = 'float';
        array_push($booksSchema['fields'], $t);
        $booksSchema['default_sorting_field'] = 'property_id';
        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, '<http://search2.thebestrealestatesearch.com:8108/collection>');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($booksSchema));

        $headers = array();
        $headers[] = 'Content-Type: application/json';
        $headers[] = 'X-Typesense-Api-Key: APIKEY';

        // $headers[] = 'X-Typesense-Api-Key: nXSIQvLOVAc9mg1wYKL9SSdOHzYulqTCcnauUEIdulqt5nSt';
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

        $result = curl_exec($ch);
        if (curl_errno($ch)) {
            echo 'Error:' . curl_error($ch);
        }
        curl_close($ch);
        dd($result);