Jump to content

loging into proboards using curl


turkman

Recommended Posts

There is a proboards site i like to visit. However, its been blocked at my work. I was trying to find a way of logging into it via my site and using that to read the proboards site. I dont really need to post or anything, just something to read when i get bored.

 

I want to keep the name of the site secret. However this is my code. Note: When i run the code i get a blank page. Nothing at all happens.

 

<?PHP



function login($website,$username,$password){

$post_data = array(

                "action" => "login2",
	"minutes" => "-1",
	"username" => $username,
	"password" => $password,

	)
Post_thread($website,$post_data);

}

function Post_thread($url,$post_data){



$options = array(
        CURLOPT_COOKIEJAR => "/tmp/cookies.txt",       // where we store the cookie.
        CURLOPT_COOKIEFILE => "/tmp/cookies.txt",      // to pass the cookie if we need too.
        CURLOPT_RETURNTRANSFER => true,     // return web page
        CURLOPT_HEADER         => false,    // don't return headers
        CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        CURLOPT_ENCODING       => "",       // handle all encodings
        CURLOPT_USERAGENT      => "spider", // who am i
        CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        //CURLOPT_REFERER        => $url, //spoof the referer
        CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
        CURLOPT_TIMEOUT        => 120,      // timeout on response
        CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
        CURLOPT_POST => true,               // we want to post some data
        CURLOPT_POSTFIELDS => $post_data,  //array of what we want to post
    );
   
    $ch      = curl_init( $url );
    curl_setopt_array( $ch, $options );
    $content = curl_exec( $ch );
    echo $content;
    $errmsg  = curl_error( $ch );
    echo $errmsg;

}



login("http://randomproboardssite.proboards.com","username","secretpassword");


?>

Link to comment
Share on other sites

I got it working anyway.  8) I still have a small problem. I used HTTP live headers firefox extension to capture the headers when i start a thread. I brings back something like this

 

-----------------------------12249266671528
Content-Disposition: form-data; name="title"

Filme 2010, filme 2009, filme noi, programe TV, program cinema, premiere cinema, trailere filme - CineMagia.ro
-----------------------------12249266671528
Content-Disposition: form-data; name="category"

3
-----------------------------12249266671528
Content-Disposition: form-data; name="tags"

filme, programe tv, program cinema
-----------------------------12249266671528
Content-Disposition: form-data; name="bodytext"

Filme 2010, filme 2009, filme noi, programe TV, program cinema, premiere cinema, trailere filme
-----------------------------12249266671528
Content-Disposition: form-data; name="trackback"


-----------------------------12249266671528
Content-Disposition: form-data; name="url"

http://cinemagia.ro
-----------------------------12249266671528
Content-Disposition: form-data; name="phase"

2
-----------------------------12249266671528
Content-Disposition: form-data; name="randkey"

9510520
-----------------------------12249266671528
Content-Disposition: form-data; name="id"

17753
-----------------------------12249266671528--

 

how do you use curl to post data like that? Usually i just use name=blah&message=blah  i dont know how to emulate this Content disposition stuff.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.