Created
July 27, 2018 04:09
-
-
Save affandhia/ecb65ab4d66c896246397f56b7cb8667 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Net.Http; | |
using System.Text; | |
using System.Collections.Specialized; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
var client = new ProxyWebClient(); | |
client.BaseAddress = "http://202.153.230.150/"; | |
try | |
{ | |
client.Headers.Clear(); | |
client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); | |
client.Headers.Add(HttpRequestHeader.Host, "info.krl.co.id"); | |
var parameters = new NameValueCollection{{"stasiun_id", "UI"}}; | |
var response = client.UploadValues("BhIRFhUeRAtUA0dQBlVSXltCABZdAFgadENeUQwETxpIEEETFBoIB0poVQtVUw0FTk9SFV8dUQZAFl0SCkZfUlFKCVUBDgIBBgNTOjQ5YmZkY2Y4", HttpMethod.Post.Method, parameters); | |
var content = Encoding.UTF8.GetString(response); | |
Console.WriteLine(content); | |
// return ResponseMessage(new HttpResponseMessage{StatusCode = HttpStatusCode.OK, Content = new StringContent(content)}); | |
} | |
catch (WebException exception) | |
{ | |
Console.Write("Hadehhh"); | |
} | |
} | |
} | |
public class ProxyWebClient : WebClient | |
{ | |
private int RequestTimeout = 10000; | |
protected override WebRequest GetWebRequest(Uri address) | |
{ | |
var request = base.GetWebRequest(address); | |
if (request != null) | |
request.Timeout = RequestTimeout; | |
return request; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment