Bitco.in Tipping bot

adamstgbit

Well-Known Member
Mar 13, 2016
1,206
2,650
Hi,

I want to experiment making a tipping bot for the forum
i want to get some php that will login to an account and send PMs to poeple
here's the code i have so far.
doesn't seem to get me logged in...


Code:
$url = 'https://bitco.in/forum/login/login';
$data = array('login' => 'adamstgbit', 'password' => '***BLA***');

// use key 'http' even if you send the request to https://...
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }

echo $result;
some help getting started would be appreciated.
 

adamstgbit

Well-Known Member
Mar 13, 2016
1,206
2,650
i got it.
found some other code

Code:
<?php

//Upload a blank cookie.txt to the same directory as this file with a CHMOD/Permission to 777
function login($url,$data){
    $fp = fopen("cookie.txt", "w");
    fclose($fp);
    $login = curl_init();
    curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt");
    curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt");
    curl_setopt($login, CURLOPT_TIMEOUT, 40000);
    curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($login, CURLOPT_URL, $url);
    curl_setopt($login, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($login, CURLOPT_POST, TRUE);
    curl_setopt($login, CURLOPT_POSTFIELDS, $data);
    ob_start();
    return curl_exec ($login);
    ob_end_clean();
    curl_close ($login);
    unset($login);   
}           

echo login("https://bitco.in/forum/login/login", "login=adamstgbit&register=0&password=***BLA***&cookie_check=1&_xfToken=&redirect=https%3A%2F%2Fbitco.in%2Fforum%2F");

?>
use httpfox to see the Post data that gets sent when logining in
and add cookie.txt in the same dir
 

lunar

Well-Known Member
Aug 28, 2015
1,001
4,290
How are you getting on? This seems like a good idea. I wonder how much room @Bloomie would give you to play around here?

I think it would be great to have some form of integrated tip bot perhaps even replacing the like button.

I'd certainly be happy to load up a few bits to tip great posts. Even if it was just a way for me to keep track of the my favorites, that I need to read again.
 

adamstgbit

Well-Known Member
Mar 13, 2016
1,206
2,650
i have some test code that logs in, scans a thread for Tip:someone+x.xxxBTC and sends a PM to the person being tipped.
it feels like a hack job, maybe @Bloomie could provide some kind of limited API that my bot could use. but i dont think its all that nessary.
i did this to get a feel for how a change tip bot would work.
but now I've shifted my focus to the wallet server aspect.
i'm looking around at various wallet API's i could use. but i'm starting to lean toward running a BU node on a AWS server, i'll have a C++ app, that interacts with the BU node on localhost and also is the webserver.

as a first pass, i'll simply want to have a server that acts like a typical centralized-web-wallet.

don't hold your breath.
this could take a while...
 

Bloomie

Administrator
Staff member
Aug 19, 2015
511
803
Not sure if adding new PHP code to the forum is a good idea for security reasons, but if you guys find the right XenForo addon that's been vetted and does the job, I'm open to implementing it.
 
  • Like
Reactions: lunar