ako sam dobro razumjeo...
Treba da si u stanju da parsiras/napravis scrapping stranice? i da si siguran da se ista ucitala?
Onda koristi
//Kod je c#, ali ga prilagodi :)
Code:
webBrowser1.Navigate(new Uri("http://negdje...")); //idi na stranicu...
private void webBrowser1_LoadCompleted(object sender, NavigationEventArgs e) //osiguraj da se ista ucitala
{
mshtml.HTMLDocument doc3 = ((mshtml.HTMLDocument)this.webBrowser1.Document);
string[] htmlkod= a.body.innerHTML.ToString().Split('>');
//radi sa html-om sta zelis...
}
Mozes to sve uraditi i na tezi nacin:
Code:
protected void Page_Load(object sender, EventArgs e)
{
//string strBuffer = "email=" + username + "&pass=" + Password + "&login=Login";
string strBuffer = "email=xxxxxxxxxxx&pass=xxxxxxxxxxxxx;login=Login";
start_post(strBuffer);
}
public void start_post(string strBuffer)
{
//Our postvars
byte[] buffer = System.Text.Encoding.ASCII.GetBytes(strBuffer);
//Initialisation
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create("https://login.facebook.com/log...2F%2Fm.facebook.com%2Fhome.php");
//Our method is post, otherwise the buffer (postvars) would be useless
WebReq.Method = "POST";
//We use form contentType, for the postvars.
WebReq.ContentType = "application/x-www-form-urlencoded";
//The length of the buffer (postvars) is used as contentlength.
WebReq.ContentLength = buffer.Length;
//We open a stream for writing the postvars
WebReq.Referer = "http://www.facebook.com/index.php?";
Stream PostData = WebReq.GetRequestStream();
//Now we write, and afterwards, we close. Closing is always important!
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
//Get the response handle, we have no true response yet!
// HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
// //Let's show some information about the response
//WebResp.StatusCode;
//WebResp.Server;
//Now, we read the response (the string), and output it.
using (HttpWebResponse response = (HttpWebResponse)WebReq.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
Response.Write(reader.ReadToEnd());
}
}
}