I'm trying to convert this code to VB.NET from java, it's the part with the "<<<<<<<<<<<<<<<<<<<<<" behind it.
my code is :
The part with the "<<<<<<<<<<<<<<<<<<<<<" behind it causes the problem. I know it's not correct. I'm trying to grab a group member from the Stream source, but I don't know how to convert it exactly from the Java code.
Any help will be appreciated, thanks.
HttpURLConnection connection = (HttpURLConnection) new URL(String.format("https://www.google.com/recaptcha/api/challenge?k=%s", siteID)).openConnection(Proxy.NO_PROXY); //Opening a connection to the recaptcha site
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); //there's probably a better way of doing this, however, networking isn't my thing. If anyone knows anything better, feel free to share.
Pattern challengePattern = Pattern.compile("challenge : '(.*?)',");
for(String buffer; ((buffer = reader.readLine()) != null);)/>/>/>/> { //Loops until reader.readLine != null
Matcher challengeMatcher = challengePattern.matcher(buffer);
if(challengeMatcher.find()) { //There should only be one, no need for a loop
captchaChallenge = challengeMatcher.group(1); //First group (.*?). <<<<<<<<<<<<<<<<<<<<<
break;
}
}
my code is :
rx = New Regex("challenge : '(.*?)'", RegexOptions.Compiled & RegexOptions.IgnoreCase)
Dim data As Stream = client.OpenRead("http://www.google.com/recaptcha/api/challenge?k=6LdIwrsSAAAAAKHnMqR20V32fL27MbkH_LR6vu8r")
Dim reader As New StreamReader(data)
Dim s As String = reader.ReadToEnd()
If voteLink Is Nothing OrElse voteLink.Length = 0 Then
Throw New ApplicationException("Specify the URI of the resource to retrieve.")
End If
siteHTML = s
challengeMatches = rx.Matches(siteHTML)
captchaChallenge = challengeMatches.ToString(1); <<<<<<<<<<<<<<<<<<<<<
ListBox1.Items.Add("captchaChallenge : " + captchaChallenge)
The part with the "<<<<<<<<<<<<<<<<<<<<<" behind it causes the problem. I know it's not correct. I'm trying to grab a group member from the Stream source, but I don't know how to convert it exactly from the Java code.
Any help will be appreciated, thanks.