Skip to content

Instantly share code, notes, and snippets.

@MaskeZen
Created August 16, 2018 14:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MaskeZen/5cc768ae34c998d3970785d245378dea to your computer and use it in GitHub Desktop.
Save MaskeZen/5cc768ae34c998d3970785d245378dea to your computer and use it in GitHub Desktop.
Cotización del BCU WS
<?php
getCotizacionesWS();
function getCotizacionesWS(){
$context = [
"ssl" => [
"verify_peer" => FALSE,
"verify_peer_name" => FALSE,
'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT
]
];
$options = [
'cache_wsdl' => WSDL_CACHE_NONE,
'stream_context' => stream_context_create($context)
];
$params = [
'Entrada' => [
'FechaDesde' => '2017-10-17',
'FechaHasta' => '2017-10-17',
'Grupo' => 2,
'Moneda' => ['item' => 2225]
]
];
$client = new SoapClient('https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/awsbcucotizaciones?wsdl', $options);
$response = $client->Execute($params);
print_r($response->Salida->datoscotizaciones);
}
@emezeta
Copy link

emezeta commented Nov 15, 2021

lo mismo pero con suds en python burocrático sin terminar 👍

https://github.com/emezeta/cotizabcu/blob/main/cotizaciones.py

si no la querés complicar tanto, entonces fatless:

from suds.client import Client
client = Client('https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/awsbcucotizaciones?wsdl')
# print(client.wsdl) <- acá podés ver métodos, operaciones, etc...
cotiza_obj = client.factory.create("wsbcucotizacionesin")
cotiza_obj.FechaDesde = '2021-11-10'
cotiza_obj.FechaHasta = '2021-11-15'
cotiza_obj.Grupo = 2
cotiza_obj.Moneda = {'item': 2225}
resultados = ret = client.service.Execute(cotiza_obj)
print(resultados)

@MaskeZen
Copy link
Author

Lo voy a tener en cuenta, gracias! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment