Untitled

mail@pastecode.io avatar
unknown
csharp
3 years ago
847 B
1
Indexable
Never
public bool OnVote(int arg)
	{
		var request = (HttpWebRequest) WebRequest.Create("https://aquafinadrop.com/backend/api/aquafina/vote");

		var postData = "Vote_1="+vote_1;
		postData += "&Vote_2="+vote_2;
		postData += "&First_Name="+first_name;
		postData += "&Last_Name="+last_name;
		postData += "&Email="+email;

		var data = Encoding.ASCII.GetBytes(postData);

		request.Method = "POST";
		request.ContentType = "application/x-www-form-urlencoded";
		request.ContentLength = data.Length;

		using (var stream = request.GetRequestStream())
		{
			stream.Write(data, 0, data.Length);
		}

		var response = (HttpWebResponse) request.GetResponse();

		var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
		
		myres = responseString.ToString();
		
		changed = true;
		
		return false;
	}