Ver Mensaje Individual
  #1
Antiguo 27 de febrero de 2015, 17:56
Roger
Forero Activo
Última Actividad 04.02.2021 13:03
Posts Posts: 236
Likes enviados Enviados: 26
Likes recibidos Recibidos: 60
Vacaciones OCR para convertir la IMG a texto
0 Inactivo Inactivo

Amigos de foro
Necesito incrustar en mi programa un enlace de consuta pero esta tiene un capcha y revisando la red un programa que evita este capcha pero esta echo en visual basic y utiliza
tessnet2.dll para convertir la imagen de pantalla en texto de esa forma lee el capcha y lo pone en el link y ya esta la consulta en linea con los datos.
aca las codigos
Código VB:
  1. private void mt_otro3()
  2. {
  3. try
  4. {
  5. //Creating the Web Request.
  6. HttpWebRequest httpWebRequest = HttpWebRequest.Create("http://www.sunat.gob.pe/cl-ti-itmrconsruc/jcrS00Alias") as HttpWebRequest;
  7. //Specifing the Method
  8. httpWebRequest.Method = "POST";
  9. //Data to Post to the Page, itis key value pairs; separated by "&"
  10. string data = "accion=consPorRuc&nroRuc=20100495989&search1:20100495989&codigo=FGRT&tipdoc=1";
  11. //Setting the content type, it is required, otherwise it will not work.
  12. httpWebRequest.ContentType = "application/x-www-form-urlencoded";
  13. //Getting the request stream and writing the post data
  14. using (StreamWriter sw = new StreamWriter(httpWebRequest.GetRequestStream()))
  15. {
  16. sw.Write(data);
  17. }
  18. //Getting the Respose and reading the result.
  19. HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse;
  20. using (StreamReader sr = new StreamReader(httpWebResponse.GetResponseStream()))
  21. {
  22. MessageBox.Show(sr.ReadToEnd());
  23. }
  24. }
  25. catch (WebException wex)
  26. {
  27. StringBuilder sb = new StringBuilder();
  28. sb.AppendLine("ERROR:" + wex.Message + ". STATUS: " + wex.Status.ToString());
  29.  
  30. if (wex.Status == WebExceptionStatus.ProtocolError)
  31. {
  32. var response = ((HttpWebResponse)wex.Response);
  33. sb.AppendLine(string.Format("Status Code : {0}", response.StatusCode));
  34. sb.AppendLine(string.Format("Status Description : {0}", response.StatusDescription));
  35.  
  36. try
  37. {
  38. StreamReader reader = new StreamReader(response.GetResponseStream());
  39. sb.AppendLine(reader.ReadToEnd());
  40. }
  41. catch (WebException ex) { throw; }
  42. }
  43.  
  44. throw new Exception(sb.ToString(), wex);
  45. }
  46.  
  47. }

inclusive he descargado un .exe no se en que lenguaje pero funciona de esa manera
yo creo que con un poco de paciencia se puede hacer en powercobol
Roger is offline   Responder Con Cita