Exemplo n.º 1
0
        public async Task <BaseResponse> GetResponseAsync(string code)
        {
            this.Code = code;
            string url = string.Format(this.UrlFormat, this.Code);

            string result = await Functions.GetHtmlSourceAsync(url, null, null, new ISO88599Encoding());

            GetTrackingDetails(result);

            string postData = JsonConvert.SerializeObject(new { docId = this.Code });
            var    headers  = new Dictionary <string, string>();

            headers.Add("X-Ajaxpro-Method", "GetCargoHistory");
            headers.Add("User-Agent", "runscope/0.1");
            result = await Functions.GetHtmlSourceAsync(this.MovementsUrlFormat, new StringContent(postData), headers);

            GetMovements(result);

            if (Tracking == null)
            {
                return new BaseResponse()
                       {
                           Status = false
                       }
            }
            ;
            else
            {
                return new BaseResponse()
                       {
                           Result = Tracking
                       }
            };
        }
Exemplo n.º 2
0
        public async Task <BaseResponse> GetResponseAsync(string code)
        {
            this.Code = code;
            string url = string.Format(this.UrlFormat, this.Code);

            string result = await Functions.GetHtmlSourceAsync(url);

            GetTrackingDetails(result);

            if (Tracking == null)
            {
                return new BaseResponse()
                       {
                           Status = false
                       }
            }
            ;
            else
            {
                return new BaseResponse()
                       {
                           Result = Tracking
                       }
            };
        }
Exemplo n.º 3
0
        public async Task <BaseResponse> GetResponseAsync(string code)
        {
            this.Code = code;
            string url = string.Format(this.UrlFormat, this.Code);

            var headers = new Dictionary <string, string>();

            headers.Add("User-Agent", "android");
            string result = await Functions.GetHtmlSourceAsync(url, null, headers);

            GetTrackingDetails(result);

            if (Tracking == null)
            {
                return new BaseResponse()
                       {
                           Status = false
                       }
            }
            ;
            else
            {
                return new BaseResponse()
                       {
                           Result = Tracking
                       }
            };
        }
Exemplo n.º 4
0
        public async Task <BaseResponse> GetResponseAsync(string code)
        {
            this.Code = code;
            string url    = string.Format(this.UrlFormat, this.Code);
            string result = await Functions.GetHtmlSourceAsync(url);

            if (!GetURLs(result))
            {
                return new BaseResponse()
                       {
                           Status = false
                       }
            }
            ;

            result = await Functions.GetHtmlSourceAsync(DetailsUrl);

            GetTrackingDetails(result);

            result = await Functions.GetHtmlSourceAsync(MovementsUrl);

            GetMovements(result);

            return(new BaseResponse()
            {
                Result = Tracking
            });
        }
Exemplo n.º 5
0
        public async Task <BaseResponse> GetResponseAsync(string code)
        {
            this.Code = code;
            string url    = string.Format(this.UrlFormat, this.Code);
            string result = await Functions.GetHtmlSourceAsync(url);

            if (result.Contains("Track Information not Found"))
            {
                return new BaseResponse()
                       {
                           Status = false
                       }
            }
            ;
            GetTrackingDetails(result);

            return(new BaseResponse()
            {
                Result = Tracking
            });
        }
Exemplo n.º 6
0
        public async Task <BaseResponse> GetResponseAsync(string code)
        {
            this.Code = code;
            string url = string.Format(this.UrlFormat, this.Code);

            string result = await Functions.GetHtmlSourceAsync(url);

            GetTrackingDetails(result);

            /*
             * using (var handler = new HttpClientHandler() { CookieContainer = myCookieContainer })
             * using (var client = new HttpClient(handler))
             * {
             *  string postData = GetPostData(result);
             *  var headers = new Dictionary<string, string>();
             *  headers.Add("X-MicrosoftAjax", "Delta=true");
             *  headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36");
             *  result = await Functions.GetHtmlSourceAsync(client, url, new StringContent(postData, Encoding.UTF8, "application/x-www-form-urlencoded; charset=UTF-8"), headers);
             * }
             *
             * GetMovements(result);*/

            if (Tracking == null)
            {
                return new BaseResponse()
                       {
                           Status = false
                       }
            }
            ;
            else
            {
                return new BaseResponse()
                       {
                           Result = Tracking
                       }
            };
        }