Results 1 to 9 of 9
-
17th Jun 2010, 01:15 AM #1OPRespected Developer
[C#] Posting a topic with SLE - Example
Example on how to post a topic using the SharpLeech Engine. You can get the .dll by downloading SharpLeech and add a reference to it in your project.
You'll need these namespaces:
PHP Code:using System;
using System.Net;
using Hyperz.SharpLeech.Engine;
using Hyperz.SharpLeech.Engine.Net;
PHP Code:// our login details
string username = "name";
string password = "****";
// the topic that we will post.
// The last argument (2) is the forums section id
SiteTopic topic = new SiteTopic("The title", "the [b]content[/b]", 2);
// Setup the object that we will use to post the topic
SiteType forum = DefaultSiteTypes.ByName("IP.Board 3.x.x").CreateInstance();
// forum url
forum.BaseUrl = "http://path.to/forum";
// Attach an event handler to the login event
// We'll use lambda expressions - quick 'n easy
forum.Login += (sender, e) =>
{
// did we actually login?
if (e.LoggedIn)
{
// yes we did
// now collect the data needed to create a new topic
forum.MakeReady(topic.SectionId);
}
};
// Now attach an event handler to the ReadyChanged event
// This event fires when all needed 'new topic' data has been collected
forum.ReadyChanged += (sender, e) =>
{
// are we really ready?
// collecting the data can fail so we need to double check
if (forum.IsReady)
{
// ok we are!
// now we can post our topic
// first create our http request
HttpWebRequest req = forum.CreateTopic(topic);
// and now make the request
HttpResult result = Http.Request(req);
// if you want you can check if there were errors
if (result.HasError)
{
// oh noes
// we can log the error if we want:
ErrorLog.LogException(result.Error);
}
// you can also grab the response data
string responseHtml = result.Data;
}
};
// with both those events setup we can now actually login
// as soon as we do all needed data will get collected and the topic posted
forum.LoginUser(username, password);
// all done!
Hyperz Reviewed by Hyperz on . [C#] Posting a topic with SLE - Example Example on how to post a topic using the SharpLeech Engine. You can get the .dll by downloading SharpLeech and add a reference to it in your project. You'll need these namespaces: using System; using System.Net; using Hyperz.SharpLeech.Engine; using Hyperz.SharpLeech.Engine.Net;The example (read the comments): // our login details string username = "name"; string password = "****"; Rating: 5
-
15th Aug 2010, 01:28 AM #2BannedWebsite's:
dcrewposter.com z51.co.ukI added the reference but when I type "Imports H" the Hyperz does'nt show
-
15th Aug 2010, 01:58 AM #3Banned
what about the code for forum.LoginUser(username, password); function ?
-
15th Aug 2010, 02:37 AM #4BannedWebsite's:
dcrewposter.com z51.co.uk
-
15th Aug 2010, 02:41 AM #5BannedWebsite's:
dcrewposter.com z51.co.ukHyperz have a prob, I'm using Basic not Sharp also in references it says cannot find the reference specified.
-
15th Aug 2010, 04:31 AM #6OPRespected Developer
-
15th Aug 2010, 05:04 AM #7BannedWebsite's:
dcrewposter.com z51.co.ukAhh I see, I'm using 2008.
-
25th Aug 2010, 05:34 PM #8BannedWebsite's:
dcrewposter.com z51.co.ukHyperz can I have a list of
SiteType forum = DefaultSiteTypes.ByName("IP.Board 3.x.x").CreateInstance();
-
26th Aug 2010, 02:34 AM #9Banned
i want to know the login way you made to login into forum ... i always fail till now in making that part. hahaha
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Need Help Topic ID
By AlanSmith23 in forum Technical Help Desk SupportReplies: 3Last Post: 26th May 2011, 08:18 AM -
posting for SHIT?????Make money even by posting now.........
By berrycorp in forum Webmasters, Money MakingReplies: 24Last Post: 7th Mar 2011, 12:15 AM -
Sharpleecher problem: Is only posting 1st post of topic!?
By svrolert in forum Webmaster DiscussionReplies: 3Last Post: 28th Feb 2011, 05:26 AM -
My first topic
By linhliver in forum IntroductionsReplies: 1Last Post: 14th Dec 2010, 02:54 PM -
Image Preview When posting a New Topic.
By Ash in forum vBulletinReplies: 3Last Post: 4th Jul 2010, 07:03 AM
themaCreator - create posts from...
Version 3.24 released. Open older version (or...