Activity Stream
48,167 MEMBERS
61051 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 9 of 9
  1.     
    #1
    Respected Developer

    Lightbulb [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
    The example (read the comments):
    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 += (sendere) =>
    {
        
    // 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 += (sendere) =>
    {
        
    // 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(usernamepassword);

    // all done! 
    There are a lot more handy classes and whatnot in SLE. Even the classes that were used here have a lot more handy properties, functions, etc. You have access to everything that makes SharpLeech tick .
    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

  2.   Sponsored Links

  3.     
    #2
    Banned
    Website's:
    dcrewposter.com z51.co.uk
    I added the reference but when I type "Imports H" the Hyperz does'nt show

  4.     
    #3
    Banned
    what about the code for forum.LoginUser(username, password); function ?

  5.     
    #4
    Banned
    Website's:
    dcrewposter.com z51.co.uk
    Quote Originally Posted by liveuploader View Post
    what about the code for forum.LoginUser(username, password); function ?
    That's part of the Engine at the bottom of the code.

  6.     
    #5
    Banned
    Website's:
    dcrewposter.com z51.co.uk
    Hyperz have a prob, I'm using Basic not Sharp also in references it says cannot find the reference specified.

  7.     
    #6
    Respected Developer
    Make sure you're using Visual Studio 2010. It's a .NET 4 assembly so you really need 2010. The dll is written in C# but you can use it in VB.NET.

    Quote Originally Posted by liveuploader View Post
    what about the code for forum.LoginUser(username, password); function ?
    Why would you need the code of that?

  8.     
    #7
    Banned
    Website's:
    dcrewposter.com z51.co.uk
    Ahh I see, I'm using 2008.

  9.     
    #8
    Banned
    Website's:
    dcrewposter.com z51.co.uk
    Hyperz can I have a list of

    SiteType forum = DefaultSiteTypes.ByName("IP.Board 3.x.x").CreateInstance();
    The default site type names can I have a list of them please? Thanks.

  10.     
    #9
    Banned
    i want to know the login way you made to login into forum ... i always fail till now in making that part. hahaha

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need Help Topic ID
    By AlanSmith23 in forum Technical Help Desk Support
    Replies: 3
    Last Post: 26th May 2011, 08:18 AM
  2. posting for SHIT?????Make money even by posting now.........
    By berrycorp in forum Webmasters, Money Making
    Replies: 24
    Last Post: 7th Mar 2011, 12:15 AM
  3. Sharpleecher problem: Is only posting 1st post of topic!?
    By svrolert in forum Webmaster Discussion
    Replies: 3
    Last Post: 28th Feb 2011, 05:26 AM
  4. My first topic
    By linhliver in forum Introductions
    Replies: 1
    Last Post: 14th Dec 2010, 02:54 PM
  5. Image Preview When posting a New Topic.
    By Ash in forum vBulletin
    Replies: 3
    Last Post: 4th Jul 2010, 07:03 AM

Tags for this Thread

BE SOCIAL