true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_ENCODING => "", // handle compressed CURLOPT_USERAGENT => "test", // name of client CURLOPT_AUTOREFERER => true, // set referrer on redirect CURLOPT_CONNECTTIMEOUT => 120, // time-out on connect CURLOPT_TIMEOUT => 120, // time-out on response ); $token = "5514145896-2356-52659-1234"; $fields = array( "token" => $token, "idreserva" => "5921", "tipo_id" => "CC", "id_huesped" => "123456-789AA-aA", "primer_nombre" => "FELIX", "segundo_nombre" => "JOSE", "primer_apellido" => "URUETA", "segundo_apellido" => "GARCES", "genero" => "M", "pais" => "COLOMBIA", "sesion" => "AGENCIA HOSPY" ); $fields_string = http_build_query($fields); $ch = curl_init("https://huespedmanager.com/hospy/api/ocupante.php"); curl_setopt_array($ch, $options); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Authorization:token $token" )); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string ); $response = curl_exec($ch); curl_close($ch); $resArrFind = array(); $resArrFind = json_decode($response); $new_array_find = objectToArray($resArrFind); echo json_encode($new_array_find); exit; ?>