Follow twitter user raw HTTP (Help)

Kollongder1

Newbie
Joined
May 3, 2015
Messages
3
Reaction score
0
Hello,

I am currently developing a bot to be able to follow users using raw HTTP and with to have no contact with the twitter API whatsoever.

I have managed to login with an account, but now, I am wondering, how do you follow another user on Twitter using raw HTTP? I have viewed and checked the HTML/JS for the twitter page but can not find anything.

I see that many have created bots for twitter here, so can anyone help me?

The one that can help me with this, I am prepared to give you a little payment as a thanks.

Regards,
 
You have to simulate the POST requests that twitter web performs. To check the requests being sent, you can use Network Monitor in chrome console or something like Fiddler. I think these are enough hints to get you started. Google around and you'll find your way.

If you have any specific questions, feel free to PM me.

Good Luck
 
Or you can use Live HTTP Headers addon for firefox to identify the requests, the fields being sent and all sort. Then you have to make a post to the said url with all the fields.

Live HTTP headers is real good one.
 
Yes, but the thing is, when you login to twitter and click on "follow" for someone, the click triggers somekind of POST in the background, so it is hard to really "track" it.

Its easier when you want to simulate the login process because there you can simply copy the POST form for the login on the twitter page and send a typical POST.

But not the same applies for the FollowButton.

Any detailed insights on this?
 
You have to simulate the POST requests that twitter web performs. To check the requests being sent, you can use Network Monitor in chrome console or something like Fiddler. I think these are enough hints to get you started. Google around and you'll find your way.

If you have any specific questions, feel free to PM me.



Good Luck

I cant PM you, I do not have 15 Points :/ have you done something similar?
 
GRAB THE USERS

$header[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36';
$c = curl_init('https://twitter.com/'.$user_to_scrape.'/followers/users?cursor='.$data_cursor_value.'&cursor_index=&cursor_offset=&include_available_features=1&include_entities=1&is_forward=true');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_jar);
curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_HTTPHEADER, $header);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT , 60);
curl_setopt($c, CURLOPT_TIMEOUT, 60);
curl_setopt($c ,CURLOPT_ENCODING, "gzip");
$follow_ajax_responce = curl_exec($c);

SEND THE FOLLOW REQUEST
$url = 'https://twitter.com/i/user/follow';


$fields = array(
'authenticity_token' => urlencode($auth_value),
'challenges_passed' => urlencode('false'),
'handles_challenges' => urlencode('1'),
'impression_id' => urlencode(''),
'inject_tweet' => urlencode('false'),
'user_id' => urlencode($user_id),
);


//url-ify the data for the POST
$fields_string = '';
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');


//open connection
$c = curl_init();


$header = array();
$header[] = 'Origin: https://twitter.com';
$header[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36';
$header[] = 'Content-Type: application/x-www-form-urlencoded';
$header[] = 'X-Requested-With: XMLHttpRequest';
$header[] = 'Referer: https://twitter.com/'.$user_name.'/followers';


//set the url, number of POST vars, POST data
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_POST, count($fields));
curl_setopt($c, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_jar);
curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($c, CURLOPT_HTTPHEADER, $header);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT ,60);
curl_setopt($c, CURLOPT_TIMEOUT, 60);
curl_setopt($c ,CURLOPT_ENCODING, "gzip");
$follow_ajax_responce = curl_exec($c);

//execute post
$result_of_follow = curl_exec($c);
 
Yes, but the thing is, when you login to twitter and click on "follow" for someone, the click triggers somekind of POST in the background, so it is hard to really "track" it.

Its easier when you want to simulate the login process because there you can simply copy the POST form for the login on the twitter page and send a typical POST.

But not the same applies for the FollowButton.

Any detailed insights on this?


All you need is a web debugging proxy like fiddler/charles/burp.
 
Back
Top