Consulta de RUC desde la WEB de SUNAT / Consultation WEB RUC from SUNAT

943 views
Skip to first unread message

Guillermo Varona Silupú

unread,
Jun 18, 2016, 9:39:44 AM6/18/16
to harbou...@googlegroups.com
Hello:
On the issue and based on what has been published here:
https://tisoft.wordpress.com/category/consultas-sunat/, I have advanced
with the code attached, but it does not work, I always returns the error
page.

What could be wrong?

TIA

BestRagards
GVS


Env. and tools:

Win7UltSP1 64b

https://github.com/tesseract-ocr/tesseract
https://sourceforge.net/projects/tesseract-ocr-alt/files/latest/download?source=files

D:\sys_gvs\utils>c:\hb32\bin\harbour -build
Harbour 3.2.0dev (r1602181602)
Copyright (c) 1999-2016, http://harbour-project.org/

Harbour Build Info
---------------------------
Version: Harbour 3.2.0dev (r1602181602)
Compiler: MinGW GNU C 5.3 (32-bit)
Platform: Windows 7 6.1.7601 Service Pack 1
PCode version: 0.3
ChangeLog last entry: 2016-02-18 17:02 UTC+0100 Przemyslaw Czerpak
(druzus/at/po
czta.onet.pl)
ChangeLog ID: 4e4f7e86646462b2e06ed2743103f53d19501977
Built on: Feb 23 2016 08:46:51
Build options: (Clipper 5.3b) (Clipper 5.x undoc)
---------------------------

ConsRUC.prg

Klas Engwall

unread,
Jun 18, 2016, 1:52:34 PM6/18/16
to harbou...@googlegroups.com
Hi Guillermo,

> On the issue and based on what has been published here:
> https://tisoft.wordpress.com/category/consultas-sunat/, I have advanced
> with the code attached, but it does not work, I always returns the error
> page.
>
> What could be wrong?

Most of us do not have Tesseract installed, so we would have to install
it first in order to run your sample code. So instead, could you please
tell us what the error message says and which line in your code it
refers to?

Regards,
Klas

Guillermo Varona Silupú

unread,
Jun 18, 2016, 3:00:51 PM6/18/16
to harbou...@googlegroups.com
Hi Klas:

Thanks for answering.
It is true, perhaps I was not too clear, I will try to explain better,
sorry for the English, I support the google translator.

The code runs well, the Tessearct does its job well and I returned the
captcha txt format plan to build my practice through the TipClientHttp ().
What happens is that the page that I gather in "datos.xml" I always
bring data error page, as if he had given wrong captcha.

I await your comments.

BestRegards
GVS

[SPA]
Es verdad, quizás no fui demasiado claro, intentaré explicar mejor, lo
siento por el inglés, me apoyo el el traductor de google.

El código se ejecuta bien, el Tessearct hace bien su trabajo y me
devuelve el captcha en formato txt plano para poder armar mi consulta a
traves del TipClientHttp().
Lo que pasa es que la pagina que recojo en "datos.xml", siempre me trae
los datos de la pagina de error, como si le hubiese dado mal el captcha.

Quedo a la espera de sus comentarios.

Klas Engwall

unread,
Jun 18, 2016, 4:03:27 PM6/18/16
to harbou...@googlegroups.com
Hi Guillermo,

> The code runs well, the Tessearct does its job well and I returned the
> captcha txt format plan to build my practice through the TipClientHttp ().
> What happens is that the page that I gather in "datos.xml" I always
> bring data error page, as if he had given wrong captcha.
>
> I await your comments.

You are still not telling us what the error message says or even if it
is a message from the website or something that tipClientHttp() itself
returns, so it is impossible to guess what is going on. If it is a
message from the website, then you should probably ask the website owner
what it means.

Regards,
Klas

gvar...@gmail.com

unread,
Jun 20, 2016, 12:56:08 AM6/20/16
to Harbour Users
Hi Klas:
Unfortunately I have serious problems with the language that do not allow me to express myself clearly.
In short, what I mean is that when I look the same URL:
1. With TIpClientHttp (): new () I get the web page with error.
    oHttp: = TIpClientHttp (): new ("http://www.sunat.gob.pe/cl-ti-itmrconsruc/jcrS00Alias?accion=consPorRuc&nroRuc=" + alltrim ((WRUC)) + "& code =" + cCaptcha + "& tipdoc = 1")

2. The same URL in the browser, I get the web page with the correct data:
                                                                                                     ====
                                                                                                     CAPTCHA
I must clarify that the consultation of the website should be done with a fresh captcha obtained from: http://www.sunat.gob.pe/cl-ti-itmrconsruc/captcha?accion=image

Thank you for your patience.


Hi Klas:
Lamentablemente tengo serios problemas con el idioma que no me permiten expresarme claramente.
En resumen, lo que quiero decir es que cuando consulto la misma URL:
1.- Con TIpClientHttp():new() obtengo la pagina WEB con error.
   oHttp:= TIpClientHttp():new( "http://www.sunat.gob.pe/cl-ti-itmrconsruc/jcrS00Alias?accion=consPorRuc&nroRuc=" + AllTrim( ( wRuc ) ) + "&codigo=" + cCaptcha + "&tipdoc=1" )

2.- El mismo URL en el navegador, me da la página WEB con los datos correctos:

Debo aclarar que la consulta de la pagina WEB debe hacerse con un captcha fresco que se obtiene de: http://www.sunat.gob.pe/cl-ti-itmrconsruc/captcha?accion=image

Gracias por su paciencia.

Best Regards
GVS

Rafa Carmona

unread,
Jun 20, 2016, 12:59:44 AM6/20/16
to harbou...@googlegroups.com

No pones lo mismo, en el código sumas 'code' y en la url pones codigo, en el paso de parámetros. A ver si va ser esa tontería :-)

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rafa Carmona

unread,
Jun 20, 2016, 3:55:54 AM6/20/16
to harbou...@googlegroups.com
Uf Sorry, puede ser que el traductor que usas, a traducido esa parte, no me di cuenta.

--
Saludos
Rafa Carmona

Guillermo Varona Silupú

unread,
Jun 20, 2016, 8:57:35 AM6/20/16
to harbou...@googlegroups.com
Hola Rafa:

Efectivamente, es por el traductor.

En resumen, lo que quiero decir, es que el resultado con una misma URL es diferente usando TIpClientHttp():new() (en un PRG) y usando un navegador.

el URL es éste:

Para el navegador:

Para el PRG
oHttp:= TIpClientHttp():new( "http://www.sunat.gob.pe/cl-ti-itmrconsruc/jcrS00Alias?accion=consPorRuc&nroRuc=10027974771&codigo=" + cCaptcha + "&tipdoc=1" )

Al momento de probar, hay que obtener un captcha fresco que se obtiene de: http://www.sunat.gob.pe/cl-ti-itmrconsruc/captcha?accion=image y usarlo en ambos casos.

Gracias por su tiempo.

Atentamente,

GVS


Atentamente,
Ing. Guillermo Varona Silupú
Piura - Perú

Elias Fuentes

unread,
Oct 5, 2016, 4:35:13 PM10/5/16
to Harbour Users
Aqui tambien les dejo una pequeña demo de como hacer consultas web de sunat


Hay una zona de prueba para integracion.
Reply all
Reply to author
Forward
0 new messages