0
People I’m studying Webrequest, I’m trying to make a query on the site of the post office and so I read it should look like this:
WebRequest request = WebRequest.Create("http://www2.correios.com.br/sistemas/rastreamento/resultado.cfm");
request.Method = WebRequestMethods.Http.Post;
request.ContentType = "application/x-www-form-urlencoded";
request.Credentials = CredentialCache.DefaultCredentials;
using (var stream = request.GetRequestStream())
{
var buffer = Encoding.UTF8.GetBytes("objetos=PU633524761BR");
stream.Write(buffer, 0, buffer.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Console.WriteLine(response.StatusDescription);
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
textBox.Text = responseFromServer;
Console.WriteLine(responseFromServer);
reader.Close();
dataStream.Close();
response.Close();
however when running it is not showing the posting history of the object so that I can retrieve the information
I’m pretty sure that’s not how you consume the mail tracking API. You’ve read the same documentation?
– CypherPotato
yes, it’s not even, I’m just studying the issue of Webrequest, to consume the API of the post office is totally different
– HimorriveL