Skip to content

Instantly share code, notes, and snippets.

@pingyen
Last active October 20, 2018 22:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save pingyen/53380 to your computer and use it in GitHub Desktop.
Save pingyen/53380 to your computer and use it in GitHub Desktop.
Plurk Bot
<?php
define('NICKNAME', 'abc');
define('PASSWORD', 'iamabc');
define('USER_ID', '123456');
$message = 'Hello World!';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
// login
curl_setopt($ch, CURLOPT_URL, 'https://www.plurk.com/login');
$response = curl_exec($ch);
$pos_s = strpos($response, '<input type="hidden" name="login_token" value="') + 47;
$token = substr($response, $pos_s, strpos($response, '"', $pos_s) - $pos_s);
curl_setopt($ch, CURLOPT_URL, 'https://www.plurk.com/Users/login');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'nick_name='.NICKNAME.'&password='.PASSWORD.'&login_token=' . $token);
curl_exec($ch);
// post
curl_setopt($ch, CURLOPT_URL, 'https://www.plurk.com/TimeLine/addPlurk');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'qualifier=says&content='.urlencode($message).'&lang=tr_ch&no_comments=0&uid='.USER_ID);
curl_exec($ch);
curl_close($ch);
?>
@pingyen
Copy link
Author

pingyen commented May 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment