示例#1
0
        public IHttpActionResult GeoYellowpageName(string fName = "", string lName = "", int houseNumber = -1, string street = "", string town = "",
                                                   string state = "", string zip   = "")
        {
            /* For a given name location find all phone numbers and names */

            string URL = "http://people.yellowpages.com/whitepages?first=" + fName
                         + "&last=" + lName + "&zip=" + town + "&state=" + state;

            try
            {
                string responseFromServer = ScraperHelper.GetURL(URL);

                List <WhitePageHit> myPhoneNums = ParseWpList(responseFromServer);
                List <WhitePageHit> toRemove    = new List <WhitePageHit>();
                foreach (WhitePageHit oneHit in myPhoneNums)
                {
                    if (!oneHit.address.Contains(street))
                    {
                        toRemove.Add(oneHit);
                    }
                }
                myPhoneNums.RemoveAll(x => toRemove.Contains(x));

                return(Ok(new PhoneLookupResult {
                    result = myPhoneNums.Count.ToString(), phoneList = myPhoneNums
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new GenericResult {
                    result = "0", payload = ex.Message
                }));
            }
        }
示例#2
0
        public IHttpActionResult GeoWhoOpenStreet(double Lat, Double Lon, int zoom = 18)
        {
            string URL = "http://nominatim.openstreetmap.org/reverse?format=json&addressdetails=1";

            URL = URL + "&zoom=" + zoom + "&lat=" + Lat + "&lon=" + Lon;
            string responseFromServer = "";

            try
            {
                responseFromServer = ScraperHelper.GetURL(URL);
            }
            catch (Exception ex)
            {
                return(Ok(new GenericResult {
                    result = "0", payload = ex.Message
                }));
            }
            return(Ok(new GenericResult {
                result = "1", payload = responseFromServer
            }));
        }
示例#3
0
        public IHttpActionResult GeoYellowpage(int houseNumber = 1, string road = "", string town = "",
                                               string state    = "", string zip = "")
        {
            string URL = "http://people.yellowpages.com/whitepages/address?street=" +
                         houseNumber + ' ' + road + "&qloc=" + town + "+" + state + "+" + zip;

            try
            {
                string responseFromServer = ScraperHelper.GetURL(URL);

                List <WhitePageHit> mynums = ParseWpList(responseFromServer);

                return(Ok(new PhoneLookupResult {
                    result = mynums.Count.ToString(), phoneList = mynums
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new GenericResult {
                    result = "0", payload = ex.Message
                }));
            }
        }