how to capture data from a webresponse/streamreader and write it back in console?

88 Views Asked by At

I created a web request with post data then getting a response telling me if it contained something, and my question is on how to also capture something else from the response and write that in the console. Do I have to create a separate GET request? and how would i do that, and how do you get something from the get request and write that into the console.

https://i.stack.imgur.com/jDSyF.jpg

try
{
    WebResponse webResponse = (HttpWebResponse)httpWebRequest.GetResponse();
    Program.logincookie = cookieContainer;
    StreamReader streamReader = new StreamReader(webResponse.GetResponseStream());
    string text4 = streamReader.ReadToEnd();
    streamReader.Close();
    webResponse.Close();



    if (!text4.Contains("Invalid username/password."))
    {
        Console.ForegroundColor = ConsoleColor.Green;

        Console.WriteLine("[HIT] " + email + ":" + password);


        File.AppendAllText("hits.txt", email + ":" + password + Environment.NewLine);
        Valid++;

    }
    else
    {
        Console.ForegroundColor = ConsoleColor.Red;
        Console.WriteLine("[BAD] " + email + ":" + password);
        Invalid++;
    }
}
catch (Exception)
{
    Console.ForegroundColor = ConsoleColor.DarkRed;
    Console.WriteLine("[BAD] " + email + ":" + password);
    Invalid++;
}
0

There are 0 best solutions below