TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
James Webb
NA
11
9.5k
Extracting Data from Website
Jun 20 2014 6:40 PM
Hi,
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
CODE:
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
Any help would be much appreciated,
Many Thanks and Kind Regards
James
Reply
Answers (
1
)
Job change
Getting Data from HTML Web Page Problem