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_php_dominicana [2022/03/30 12:51] scastillo creado |
codigo_php_dominicana [2025/03/26 18:28] (actual) scastillo |
||
---|---|---|---|
Línea 3: | Línea 3: | ||
[[start|{{ : | [[start|{{ : | ||
- | < | + | < |
- | ljh | + | <?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); | ||
+ | |||
+ | ?> | ||
</ | </ | ||
- | < | + | < |
- | 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|{{: | ||