I know that my question looks like a duplicated question, but I could not find a helpful solution for my issue.
So I am trying to scrape data from a cargo ships data providing website Link (It's a Korean website. The black button on the right is the search button)
but in order to obtain data from it, some radio buttons have to be set up then hit search.
I thought I would be able to just pass parameters values through FormUrlEncodedContent then simply use PostAsync, but somehow I could not be able to get them pass through.
Here is my codes so far
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36");
client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/x-www-form-urlencoded");
var doc = new HtmlAgilityPack.HtmlDocument();
var content = new FormUrlEncodedContent(structInfo.ScriptValues);
var response = await client.PostAsync(structInfo.PageURL, content);
var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
using (WebClient client = new WebClient())
{
var reqparm = new System.Collections.Specialized.NameValueCollection();
reqparm.Add("v_time", "month");
reqparm.Add("ROCD", "ALL");
reqparm.Add("ORDER", "item2");
reqparm.Add("v_gu", "S");
byte[] responsebytes = client.UploadValues("http://info.bptc.co.kr:9084/content/sw/frame/berth_status_text_frame_sw_kr.jsp", "POST", reqparm);
string responsebody = Encoding.UTF8.GetString(responsebytes);
Console.WriteLine(responsebody);
}
Values I put in the StructInfo Class
PageURL = "http://info.bptc.co.kr:9084/content/sw/frame/berth_status_text_frame_sw_kr.jsp",
ScriptValues = new Dictionary<string, string>
{
{"v_time", "month"},
{"ROCD", "ALL"},
{"ORDER", "item2"},
{"v_gu", "S"}
},
What I have tried so far are HttpClient, WebClient, WebBrowser but I had no luck.
But a strange thing is when I try to send a post with Burp Suite, data comes out just fine like the way in I wanted.
I've been searching a solution for last 4 hours, didn't have any luck.
Would you guys mind help me?
Thanks