1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
using System;
using System.Text;
using System.IO;
using System.Net;
using static System.Net.WebRequestMethods;
using System.Collections.Specialized;
public static class Http
{
public static byte[] Post(string uri, NameValueCollection pairs)
{
byte[] response = null;
using (WebClient client = new WebClient())
{
response = client.UploadValues(uri, pairs);
}
return response;
}
}
class Program
{
static void Main(string[] args)
{
connexion("login", "password");
}
public static void connexion(String login, String password)
{
var connexion = Http.Post("https://site.com/ajax.php", new NameValueCollection() {
{ "request", "login" },
{ "do_login", "1" },
{ "login", login },
{ "password", password }
});
Console.WriteLine(resultConnexion);
}
} |
Partager