This is my first post on this website that was recommended to me by my computing teacher. I have only recently started to learn C# programming and I'm playing around with a project for my mothers business as a letting agent to find properties for her to rent. I find suitable properties by extracting information such as the date of the listing, mobile phone numbers and cost per week.
I have managed to get phone numbers of pages by using the following code with the following URL
http://www.gumtree.com/p/flats-houses/4-bedroom-terraced-student-house-to-rent-in-university-area/1022509215
public void GetMobileNumber()
{
//This code will find matches on single webpages and store them in a match collection
string UserURL = textBox1.Text;
WebClient MyWebClient = new WebClient();
//the url in the following line is for testing and must be changeing according to a search variable later!!!!
String HTMLString = MyWebClient.DownloadString(UserURL);
MatchCollection MatchedMobiles = Regex.Matches(HTMLString, "<span class=\"contact-phone-number\">\\s*(.+?)\\s*</span>", RegexOptions.Singleline);
//This code will put the matches into the list defined above
foreach (Match m in MatchedMobiles)
{
string MobileNumber = m.Groups[1].Value;
string FirstTwoNumbers = MobileNumber.Substring(0, 2);
if (FirstTwoNumbers == "07")
{
MobileNumberList.Add(MobileNumber);
}
}
MobileNumberList = MobileNumberList.Distinct().ToList();
ListBoxPhoneNumbers.DataSource = MobileNumberList;
}
I'm struggling to do the same thing but for date added on the following URL:
http://www.gumtree.com/search?current_distance=&seller_type=private&property_type=&min_property_number_beds=&max_property_number_beds=&min_price=&max_price=&q=&search_location=Reading&category=flats-and-houses-for-rent&search_scope=title