meta data de esta página
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Próxima revisión | Revisión previa | ||
|
codigo_java_dominicana [2023/11/13 19:06] scastillo creado |
codigo_java_dominicana [2024/03/20 02:31] (actual) 47.128.30.61 se ha restaurado la vieja versión (2023/11/13 19:08) |
||
|---|---|---|---|
| Línea 3: | Línea 3: | ||
| [[start|{{ : | [[start|{{ : | ||
| - | < | + | < |
| - | import | + | import |
| - | import | + | import |
| + | import org.apache.http.client.methods.HttpPost; | ||
| + | import org.apache.http.entity.StringEntity; | ||
| + | import org.apache.http.impl.client.HttpClientBuilder; | ||
| - | respjson={" | + | import java.io.IOException; |
| - | j={" | + | public class Main { |
| + | public static void main(String[] args) throws IOException { | ||
| + | String url = " | ||
| + | String json = "{\" | ||
| - | response | + | HttpClient httpClient |
| + | HttpPost request = new HttpPost(url); | ||
| + | StringEntity params = new StringEntity(json); | ||
| + | request.addHeader(" | ||
| + | request.setEntity(params); | ||
| + | |||
| + | HttpResponse response | ||
| + | System.out.println(response); | ||
| + | } | ||
| + | } | ||
| - | print(" | ||
| - | print(response.json()) #Imprimimos el resultado en json | ||
| - | print(" | ||
| - | respjson=json.dumps(response.json()) | ||
| - | print(respjson.capitalize()) #Imprimimos el resultado en json en minusculas | ||
| - | print(" | ||
| - | print(" | ||
| </ | </ | ||