Fitur TweetLonger WriteLonger untuk Dabr (Twitter Client)


Pertama, cari fungsi twitter_update() di file /common/twitter.php
kemudian cari baian: if ($status) {
dan sebelem: $request = API_URL.’statuses/update.json’;
tambahkan code di bawah ini

if (mb_strlen($status, ‘utf-8′) > 140) {
$header = array(
‘X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json’,
‘X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/"’
);
require_once(‘OAuth.php’);
$consumer = new OAuthConsumer(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);
$sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
list($oauth_token, $oauth_token_secret) = explode(‘|’, $GLOBALS['user']['password']);
$token = new OAuthConsumer($oauth_token, $oauth_token_secret);
$signingURL = ‘https://api.twitter.com/1/account/verify_credentials.json’;
$request = OAuthRequest::from_consumer_and_token($consumer, $token, ‘GET’, $signingURL, array());
$request->sign_request($sha1_method, $consumer, $token);

$header[1] .= ", oauth_consumer_key=\"" . $request->get_parameter(‘oauth_consumer_key’) ."\"";
$header[1] .= ", oauth_signature_method=\"" . $request->get_parameter(‘oauth_signature_method’) ."\"";
$header[1] .= ", oauth_token=\"" . $request->get_parameter(‘oauth_token’) ."\"";
$header[1] .= ", oauth_timestamp=\"" . $request->get_parameter(‘oauth_timestamp’) ."\"";
$header[1] .= ", oauth_nonce=\"" . $request->get_parameter(‘oauth_nonce’) ."\"";
$header[1] .= ", oauth_version=\"" . $request->get_parameter(‘oauth_version’) ."\"";
$header[1] .= ", oauth_signature=\"" . urlencode($request->get_parameter(‘oauth_signature’)) ."\"";

$longtweetlink = ‘http://api.writelonger.com/create.php’;
$contents = array(‘text’=>urlencode($status),
‘api_key’=>’WL_H52m239dvsd’,
‘format’=>’json’);
foreach($contents as $key=>$value) {
$fields .= $key . ‘=’ . $value . ‘&’;
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $longtweetlink);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$respond = curl_exec($ch);
$response_info = curl_getinfo($ch);
curl_close($ch);
$result = json_decode($respond);
$status = $result->text;
}

Jangan lupa kunjungi & gunakan Twitter Client dari kami di alamat www.imorv.com :)

@fays_ozunugt; 140) {
$header = array(
‘X-Auth-Service-Provider: https://api.twitter.com/1/account/verify_credentials.json’,
‘X-Verify-Credentials-Authorization: OAuth realm="http://api.twitter.com/"’
);
require_once(‘OAuth.php’);
$consumer = new OAuthConsumer(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);
$sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
list($oauth_token, $oauth_token_secret) = explode(‘|’, $GLOBALS['user']['password']);
$token = new OAuthConsumer($oauth_token, $oauth_token_secret);
$signingURL = ‘https://api.twitter.com/1/account/verify_credentials.json’;
$request = OAuthRequest::from_consumer_and_token($consumer, $token, ‘GET’, $signingURL, array());
$request->sign_request($sha1_method, $consumer, $token);

$header[1] .= ", oauth_consumer_key=\"" . $request->get_parameter(‘oauth_consumer_key’) ."\"";
$header[1] .= ", oauth_signature_method=\"" . $request->get_parameter(‘oauth_signature_method’) ."\"";
$header[1] .= ", oauth_token=\"" . $request->get_parameter(‘oauth_token’) ."\"";
$header[1] .= ", oauth_timestamp=\"" . $request->get_parameter(‘oauth_timestamp’) ."\"";
$header[1] .= ", oauth_nonce=\"" . $request->get_parameter(‘oauth_nonce’) ."\"";
$header[1] .= ", oauth_version=\"" . $request->get_parameter(‘oauth_version’) ."\"";
$header[1] .= ", oauth_signature=\"" . urlencode($request->get_parameter(‘oauth_signature’)) ."\"";

$longtweetlink = ‘http://api.writelonger.com/create.php’;
$contents = array(‘text’=>urlencode($status),
‘api_key’=>’WL_H52m239dvsd’,
‘format’=>’json’);
foreach($contents as $key=>$value) {
$fields .= $key . ‘=’ . $value . ‘&’;
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $longtweetlink);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$respond = curl_exec($ch);
$response_info = curl_getinfo($ch);
curl_close($ch);
$result = json_decode($respond);
$status = $result->text;
}

Jangan lupa kunjungi & gunakan Twitter Client dari kami di alamat www.imorv.com :)

@fays_ozunu

2 Tanggapan

  1. kunjungi punya ane, di http://www.zbuddy.16mb.com pasti pas mau masuk keluar error 500 :( .totlong kasi solusi yaa

  2. gan ane dah buat twitter klien dari dabr,terus pas mau nyoba eh keluar error 500.bisa bantu ane gak?

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.

Bergabunglah dengan 7.942 pengikut lainnya.