Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading.Tasks;
- using System.Net;
- using System.IO;
- using System.Text;
- namespace MyNamespace {
- public class MyActivity {
- private async Task<bool> Request () {
- string url = "http://noigan.it/wp-admin/admin-ajax.php";
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create (new Uri(url));
- request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
- request.Headers.Add("Cookie", "wordpress_27e6e5f71b0ae47d93d1b1eace534cb8=mirko.diciaccio%40mobilesoft.it%7C1484125300%7CkcjNDhhORFpwtI3hMVxnXYDtBPTPcFBIgebbZvvAiBb%7Cbf9d46ad01f08c5459c99f16397872d54cb97b5b6295bf59d3b9c452289c05e0; PHPSESSID=arhns73eqttfoi2o4q0mhfl585; wordpress_logged_in_27e6e5f71b0ae47d93d1b1eace534cb8=mirko.diciaccio%40mobilesoft.it%7C1484125300%7CkcjNDhhORFpwtI3hMVxnXYDtBPTPcFBIgebbZvvAiBb%7C2c0f3473fdf8693675d2ce1b9d78ce1625525630230771489ed55c4513ce79c6");
- request.Method = "POST";
- string postData = "action=na_login&username=mirko.diciaccio%40mobilesoft.it&password=test_password";
- ASCIIEncoding encoding = new ASCIIEncoding ();
- byte[] byte1 = encoding.GetBytes (postData);
- request.ContentLength = byte1.Length;
- Stream newStream = request.GetRequestStream ();
- newStream.Write (byte1, 0, byte1.Length);
- newStream.Close ();
- using (WebResponse response = await request.GetResponseAsync ()) {
- using (Stream stream = response.GetResponseStream ()) {
- return true;
- //process the response
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement