-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPackageTracker.cs
More file actions
31 lines (26 loc) · 863 Bytes
/
PackageTracker.cs
File metadata and controls
31 lines (26 loc) · 863 Bytes
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
using System.Collections.Specialized;
using System.Net;
using System.Text;
namespace BelpostTrackingAPI
{
public enum PackageType
{
regional = 1, international = 2
}
public class PackageTracker
{
public static string TrackByNumber(string trackNumber, PackageType type)
{
string responseString;
using (var client = new WebClient())
{
var values = new NameValueCollection();
values["item"] = trackNumber;
values["internal"] = ((int)type).ToString();
var response = client.UploadValues("http://search.belpost.by/ajax/search", values);
responseString = Encoding.UTF8.GetString(response, 0, response.Length);
}
return responseString;
}
}
}