hello Friends,
im facing confusion abt how to access content of other's site to our main site. I have necesary rughjts to do it, but i havnt idea abt how to do it...
is thr any one can help me by posting some resources regarding content grabbing with ASP.NET in C#..? or source code or examples..
i cant grabe content by RSS cos source site s not using XML functionality to present data..
Pls frirends help me..thanking you in advance...
Shining Star.
http://www.freewebs.com/jiten_p_parmar
Thanks for ur reply...but steel i cant found proper solution..
see here i have typed code that ll fatches external web's whole content into my webpage..B
By WebRequest
WebRequest request;
request= WebRequest.Create("http://www.microsoft.com");
WebResponse response;
response = request.GetResponse();
Stream s;
s= response.GetResponseStream();
StreamReader sr =new StreamReader(s,System.Text.Encoding.UTF8);
Response.Write(sr.ReadToEnd());
response.Close();
sr.Close();
and here im typing code that doing same functionality with use of creating object of WebClient.
By WebClient
WebClient myClient =new WebClient();
string myPageHTML =null;
byte[] requestHTML;
string currentPageUrl = Request.Url.ToString();
UTF8Encoding utf8 =new UTF8Encoding();
currentPageUrl = "http://Localhost/WebApplication9/Page1.htm"; // or give any other external site URL.
requestHTML = myClient.DownloadData(currentPageUrl);
myClient.DownloadFile(currentPageUrl,FileName);
myPageHTML = utf8.GetString(requestHTML);
Response.Write(myPageHTML);
//TextBox1.Text =myPageHTML.ToString(); //U can also past Source of External Site into Textbox
But i need to grab only specifide content not whole page ..n i need to search words from External site from where i can grab n past whole article into my page...
i know RSS s the best way to do this task but source site dosnt presenting data with XML file. so for that i have to use another technology to do this task..
HElp me dude...
Thanks in advance..
Having retrieved the external HTML content, to match selected portions of the page you should use the RegEx class, and specifically its Match method.
0 comments:
Post a Comment