meta data de esta página
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
codigo_php_dominicana [2024/03/19 19:10] 47.128.97.238 se ha restaurado la vieja versión (2022/03/30 12:55) |
codigo_php_dominicana [2025/03/26 18:28] (actual) scastillo |
||
|---|---|---|---|
| Línea 7: | Línea 7: | ||
| // API URL | // API URL | ||
| - | $url=" | + | $url=" |
| // Se crea un nuevo recurso | // Se crea un nuevo recurso | ||
| Línea 13: | Línea 13: | ||
| // Se crea el array de los datos | // Se crea el array de los datos | ||
| - | $data = array(' | + | $data = array(' |
| //Se convierte en formato json | //Se convierte en formato json | ||
| Línea 51: | Línea 51: | ||
| <code php Enviar> | <code php Enviar> | ||
| - | lkgkjygtk | + | <?php |
| + | |||
| + | // API URL | ||
| + | $url=" | ||
| + | |||
| + | // Se crea un nuevo recurso | ||
| + | $ch = curl_init($url); | ||
| + | |||
| + | // Se crea el array de los datos | ||
| + | $data = array ( | ||
| + | ' | ||
| + | ' | ||
| + | array ( | ||
| + | ' | ||
| + | array ( | ||
| + | ' | ||
| + | array ( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | array ( | ||
| + | 0 => | ||
| + | array ( | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | ), | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | ' | ||
| + | array ( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | array ( | ||
| + | 0 => ' | ||
| + | 1 => ' | ||
| + | ), | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | ' | ||
| + | array ( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | ' | ||
| + | array ( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | ' | ||
| + | ' | ||
| + | array ( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | ' | ||
| + | ), | ||
| + | ' | ||
| + | array ( | ||
| + | 0 => | ||
| + | array ( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | ), | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ), | ||
| + | ); | ||
| + | |||
| + | //Se convierte en formato json | ||
| + | $payload = json_encode($data); | ||
| + | |||
| + | // Opciones headers | ||
| + | curl_setopt($ch, | ||
| + | |||
| + | // Set contenido json en Body | ||
| + | curl_setopt($ch, | ||
| + | |||
| + | // Retornar inmediatamente respueta | ||
| + | curl_setopt($ch, | ||
| + | |||
| + | // Se ejecuta el PST | ||
| + | $result = curl_exec($ch); | ||
| + | |||
| + | $result2=json_decode($result); | ||
| + | |||
| + | // | ||
| + | // | ||
| + | |||
| + | |||
| + | echo "Los datos recibidos son los siguientes: "; | ||
| + | echo "< | ||
| + | foreach($result2 as $resul){ | ||
| + | echo "< | ||
| + | echo $resul; | ||
| + | echo "< | ||
| + | } | ||
| + | |||
| + | // Se cierra el recurso | ||
| + | curl_close($ch); | ||
| + | |||
| + | ?> | ||
| </ | </ | ||
| + | |||
| + | |||
| + | <code php descargarArchivo> | ||
| + | <?php | ||
| + | |||
| + | // API URL | ||
| + | $url=" | ||
| + | |||
| + | // Se crea un nuevo recurso | ||
| + | $ch = curl_init($url); | ||
| + | |||
| + | // Se crea el array de los datos | ||
| + | $data = array ( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ); | ||
| + | |||
| + | //Se convierte en formato json | ||
| + | $payload = json_encode($data); | ||
| + | |||
| + | // Opciones headers | ||
| + | curl_setopt($ch, | ||
| + | |||
| + | // Set contenido json en Body | ||
| + | curl_setopt($ch, | ||
| + | |||
| + | // Retornar inmediatamente respueta | ||
| + | curl_setopt($ch, | ||
| + | |||
| + | // Se ejecuta el PST | ||
| + | $result = curl_exec($ch); | ||
| + | |||
| + | $result2=json_decode($result); | ||
| + | |||
| + | // | ||
| + | // | ||
| + | |||
| + | |||
| + | echo "Los datos recibidos son los siguientes: "; | ||
| + | echo "< | ||
| + | foreach($result2 as $resul){ | ||
| + | echo "< | ||
| + | echo $resul; | ||
| + | echo "< | ||
| + | } | ||
| + | |||
| + | // Se cierra el recurso | ||
| + | curl_close($ch); | ||
| + | |||
| + | ?> | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| [[start|{{: | [[start|{{: | ||