I am scraping a website, so far i was successful to get source code (I think its simple task). From the source code can we extract the contents inside
Similarly i have around 10-12
Here is my code so far :
string url = "http://geoportaal.maaamet.ee/url/xgis-ky.php?ky=41201:004:0067";
string strResult = "";
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
strResult = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
MessageBox.Show(strResult);
Posted Jul 30, 2014, 3:23 PM
Int index=0;
foreach (Match m in m1)
{
String value=m.Value;
String[] data=value.split(':');
dr[index]=data[1];
Index.++;
}
Make sure m1 count is equal to table column count
Thanks,
Kailash
Posted Aug 1, 2014, 10:52 AM
Was your problems solved?
Rajesh KumarPosted Jul 30, 2014, 1:45 PM
I have modified bit, because it was showing some error: still for Data cell i am getting error,
For "DataCell dc = new DataCell();" i am getting error.
I have modified Datarow by adding data table.
DataTable table = new DataTable();
DataRow dr = table.NewRow();
foreach (Match m in m1)
{
String value = m.Value;
String[] data = value.Split(':');
DataCell dc = new DataCell();
dc.value = data[1];
dr.cell.add(dc);
}
dataGridView1.Rows.Add(dr);
Posted Jul 30, 2014, 1:27 PM
If you have columns with grid, if not create
DataRow dr= new DataRow();
foreach (Match m in m1)
{
String value=m.Value;
String[] data=value.split(':');
DataCell dc=new DataCell();
dc.value=data[1];
dr.cell.add(dc);
}
dataGridView1.rows.add(dr);
Rajesh KumarPosted Jul 30, 2014, 12:47 PM
Here is my strResults
Posted Jul 30, 2014, 12:37 PM
Rajesh KumarPosted Jul 30, 2014, 11:22 AM
foreach (Match m in m1)
{
dataGridView1.DataSource = m.Value;
}
Posted Jul 30, 2014, 11:02 AM
Rajesh KumarPosted Jul 30, 2014, 10:39 AM
Posted Jul 30, 2014, 10:32 AM
User Reqular Expression to filter li data.
string url = "http://geoportaal.maaamet.ee/url/xgis-ky.php?ky=41201:004:0067";
string strResult = "";
WebResponse objResponse;
WebRequest objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
strResult = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
MatchCollection m1 = Regex.Matches(strResult , @"(
Kindly Mark as answer if it helps your.
Thanks,
Kailash