Ok Hyperz... I've been trying to use your source to Sharp Leech and all is well, and I must say you are a brilliant coder.
However I am not trying to use your script for my personal use. I am simply using your script as a reference to what I want to do. Basically what I want to do is create a Forum Leecher like yours. I have designed a layout that I am Satisfied with and am now ready to begin coding.
For my login area, I have a spot to select what forum, to enter username, and enter password, and a button t click that logs you in.
I have a small dilemma, This is my code that I have so far:
Visual Studio 2010 is telling me that there is no such thing as System.Net.WebRequest.CookieContainer
The code am having trouble with is this section:
I was wondering if you could shed a little of you knowledge on to me....
Thanks.
However I am not trying to use your script for my personal use. I am simply using your script as a reference to what I want to do. Basically what I want to do is create a Forum Leecher like yours. I have designed a layout that I am Satisfied with and am now ready to begin coding.
For my login area, I have a spot to select what forum, to enter username, and enter password, and a button t click that logs you in.
I have a small dilemma, This is my code that I have so far:
PHP:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Threading;
using System.IO;
using System.Diagnostics;
using System.Net.Configuration;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text.RegularExpressions;
using System.Web;
using HtmlAgilityPack;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void login_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
try
{
Thread.Sleep(5000); //Hangs the Cursor for a while
}
finally
{
Cursor.Current = Cursors.Default;
}
#region Login Information
{
const string username = @"";
const string password = @"";
const string md5 = @"";
CookieContainer cookieMonster = new CookieContainer();
string postArgs = String.Format(
@"raw_login_password={0}&do=login&url=%2Fforum%2Fusercp.php&vb_login_md5password={2}&vb_login_md5password_utf={2}&s=&securitytoken=guest&vb_login_username={1}&vb_login_password=",
password,
username,
md5
);
WebRequest req = (WebRequest)WebRequest.Create("forumpath" + "login.php");
req.Method = "POST";
req.CookieContainer = cookieMonster;
req.Referrer = @"forumpath" + "login.php";
req.ContentType = @"application/x-www-form-urlencoded";
byte[] buffer = System.Text.ASCIIEncoding.UTF8.GetBytes(postArgs);
req.ContentLength = buffer.Length;
req.AllowAutoRedirect = true;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Close();
}
WebResponse response = (WebResponse)req.GetResponse();
using (Stream respStream = response.GetResponseStream()) ;
{
using (StreamReader sr = new StreamReader(respStream))
{
string s = sr.ReadToEnd();
System.Diagnostics.Debugger.Break();
}
}
#endregion
}
}
}
}
Visual Studio 2010 is telling me that there is no such thing as System.Net.WebRequest.CookieContainer
The code am having trouble with is this section:
PHP:
WebRequest req = (WebRequest)WebRequest.Create("forumpath" + "login.php");
req.Method = "POST";
req.CookieContainer = cookieMonster;
req.Referrer = @"forumpath" + "login.php";
req.ContentType = @"application/x-www-form-urlencoded";
byte[] buffer = System.Text.ASCIIEncoding.UTF8.GetBytes(postArgs);
req.ContentLength = buffer.Length;
req.AllowAutoRedirect = true;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(buffer, 0, buffer.Length);
reqStream.Close();
}
I was wondering if you could shed a little of you knowledge on to me....
Thanks.