H
HisKingdom
Guest
I want to read from a list.txt file and replace GUID and PASSWORD in the string URL with contents from List.txt
List.txt Format (separated by ,)
userteste@gmail.com,paswwrws1241
usertwo@gmail.com,ejhiuhiuy
userthree@gmail.com,sdfe3uh32
using System;
using System.Net;
using System.IO;
namespace Test
{
class Log
{
}
}
namespace APITEST
{
public class Log
{
public static string GUID; // HOW TO READ THIS FROM .TXT FILE
public static string PASSWORD; // HOW TO READ THIS FROM .TXT FILE
//NEED TO OPEN TO READ THESE FROM .TXT FILE
private static readonly string URL = "https://www.testerdomaindb.com/users/verify?guid=" + GUID + "&" + PASSWORD;
private static readonly string DATA = @"{""object"":{""name"":""Name""}}";
static void Main(string[] args)
{
Log.CreateObject();
}
private static void CreateObject()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "POST";
request.ContentType = "text/plain"; // text/html
request.ContentLength = DATA.Length;
using (Stream webStream = request.GetRequestStream())
using (StreamWriter requestWriter = new StreamWriter(webStream, System.Text.Encoding.ASCII))
{
requestWriter.Write(DATA);
}
try
{
WebResponse webResponse = request.GetResponse();
using (Stream webStream = webResponse.GetResponseStream())
{
if (webStream != null)
{
using (StreamReader responseReader = new StreamReader(webStream))
{
string response = responseReader.ReadToEnd();
Console.ForegroundColor = ConsoleColor.White;
Console.Out.WriteLine(response);
Console.ReadKey();
}
}
}
}
catch (Exception e)
{
Console.Out.WriteLine(e.Message);
Console.ReadKey();
}
}
}
}
Continue reading...
List.txt Format (separated by ,)
userteste@gmail.com,paswwrws1241
usertwo@gmail.com,ejhiuhiuy
userthree@gmail.com,sdfe3uh32
using System;
using System.Net;
using System.IO;
namespace Test
{
class Log
{
}
}
namespace APITEST
{
public class Log
{
public static string GUID; // HOW TO READ THIS FROM .TXT FILE
public static string PASSWORD; // HOW TO READ THIS FROM .TXT FILE
//NEED TO OPEN TO READ THESE FROM .TXT FILE
private static readonly string URL = "https://www.testerdomaindb.com/users/verify?guid=" + GUID + "&" + PASSWORD;
private static readonly string DATA = @"{""object"":{""name"":""Name""}}";
static void Main(string[] args)
{
Log.CreateObject();
}
private static void CreateObject()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "POST";
request.ContentType = "text/plain"; // text/html
request.ContentLength = DATA.Length;
using (Stream webStream = request.GetRequestStream())
using (StreamWriter requestWriter = new StreamWriter(webStream, System.Text.Encoding.ASCII))
{
requestWriter.Write(DATA);
}
try
{
WebResponse webResponse = request.GetResponse();
using (Stream webStream = webResponse.GetResponseStream())
{
if (webStream != null)
{
using (StreamReader responseReader = new StreamReader(webStream))
{
string response = responseReader.ReadToEnd();
Console.ForegroundColor = ConsoleColor.White;
Console.Out.WriteLine(response);
Console.ReadKey();
}
}
}
}
catch (Exception e)
{
Console.Out.WriteLine(e.Message);
Console.ReadKey();
}
}
}
}
Continue reading...