Sina micro-blog – status update by code

image: http://ciberprensa.com/clones-de-twitter/
Not really been a fan of copycat sites like the Sina Microblog, considering how shamelessly ideas and features were lifted without any credit. Hell, even its yet-to-be-made-public API set is a lost syntactic twin brother of Twitter’s.
Given the ubiquity of the service in this part of the world (due to good marketing and ignorance of the masses nonetheless) though, it’s hard to avoid hearing about it every now and then.
To that end, this PHP code snippet (tested to work) might be handy sometime:
$ch = curl_init();
// login
curl_setopt($ch, CURLOPT_URL, 'https://login.sina.com.cn/sso/login.php');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=xxxxxx&password=yyyy&returntype=TEXT');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
// update status
curl_setopt($ch, CURLOPT_URL, 'http://t.sina.com.cn/mblog/publish.php');
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'content=test microblog update!');
curl_setopt($ch,CURLOPT_REFERER,'http://t.sina.com.cn/');
$store = curl_exec ($ch);
No related posts.

